File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -462,20 +462,24 @@ void init_constraint(Rice::Module& m) {
462462 queue.pop ();
463463 }
464464
465- callback.call (" response=" , r);
466- callback.call (" on_solution_callback" );
465+ bool stop = false ;
466+ try {
467+ callback.call (" response=" , r);
468+ callback.call (" on_solution_callback" );
469+ stop = static_cast <bool >(callback.attr_get (" @stopped" ));
470+ } catch (const Rice::Exception& e) {
471+ exception = e;
472+ stop = true ;
473+ }
467474
468- if (callback. attr_get ( " @stopped " ) ) {
475+ if (stop ) {
469476 StopSearch (&m);
470477 return Qnil;
471478 }
472479 }
473480
474481 Rice::detail::protect (rb_thread_schedule);
475482 }
476- } catch (const Rice::Exception& e) {
477- exception = e;
478- StopSearch (&m);
479483 } catch (const std::exception& e) {
480484 exception = Rice::Exception (rb_eRuntimeError, e.what ());
481485 StopSearch (&m);
You can’t perform that action at this time.
0 commit comments