# HG changeset patch # User Pantxo Diribarne # Date 1515076726 -3600 # Node ID a56d283ff18a58a9b0000ed7b246570e2475cfbb # Parent 501986e12b8b29dc8d4d7f053dcf5520b1c446b1 Honor "interruptible" for property listeners (bug #52804). * NEWS: Announce "interruptible" property is fully implemented. * graphics.cc (gh_manager::do_execute_listener): If the currently executing callback is not interruptible, queue or cancel listeners. diff -r 501986e12b8b -r a56d283ff18a NEWS --- a/NEWS Wed Jan 03 21:21:41 2018 +0100 +++ b/NEWS Thu Jan 04 15:38:46 2018 +0100 @@ -63,8 +63,12 @@ explicitly instructed to perform an economy factorization by using a final argument of 0. - ** The graphic object property "PickableParts" has been implemented which - controls whether an object can accept mouse clicks. + ** The graphic object property "PickableParts" has been implemented + which controls whether an object can accept mouse clicks. + + ** The graphic object property "Interruptible" has been fully + implemented which controls whether a running callback function can + be interrupted by another callback function. ** Text objects now implement the properties "BackgroundColor", "EdgeColor", "LineStyle", "LineWidth", and "Margin". diff -r 501986e12b8b -r a56d283ff18a libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Wed Jan 03 21:21:41 2018 +0100 +++ b/libinterp/corefcn/graphics.cc Thu Jan 04 15:38:46 2018 +0100 @@ -10223,6 +10223,20 @@ gh_manager::do_execute_listener (const graphics_handle& h, const octave_value& l) { + if (! callback_objects.empty ()) + { + const graphics_object& current = callback_objects.front (); + + if (current.valid_object () + && ! current.get_properties ().is_interruptible ()) + { + if (get_object (h).get_properties ().busyaction_is ("queue")) + do_post_event (graphics_event::create_callback_event (h, l)); + + return; + } + } + if (octave::thread::is_thread ()) gh_manager::execute_callback (h, l, octave_value ()); else