diff -r a17d388f3588 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Mon Jun 04 22:19:01 2018 +0200 +++ b/libinterp/corefcn/graphics.cc Mon Jun 04 23:29:46 2018 +0200 @@ -2658,6 +2658,9 @@ bp.set_beingdeleted (true); + // delete listeners before invalidating object + p->second.remove_all_listeners (); + bp.delete_children (); // NOTE: Call the delete function while the object's state is still valid. diff -r a17d388f3588 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Mon Jun 04 22:19:01 2018 +0200 +++ b/libinterp/corefcn/graphics.in.h Mon Jun 04 23:29:46 2018 +0200 @@ -2860,6 +2860,8 @@ void delete_property_listener (const std::string& nm, const octave_value& v, listener_mode mode = POSTSET) { rep->delete_property_listener (nm, v, mode); } + + void remove_all_listeners (void) { rep->remove_all_listeners (); } void initialize (void) { rep->initialize (*this); }