diff --git a/ChangeLog b/ChangeLog index a1285acb..bb432607 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2016-07-30 Markus Gans + * Delete all callbacks from a widget, when it will be destroyed + 2016-07-28 Markus Gans * Improvements for the window focus diff --git a/src/fwidget.cpp b/src/fwidget.cpp index c8f4d26f..60cc01b8 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -103,8 +103,8 @@ FWidget::FWidget (FWidget* parent) //---------------------------------------------------------------------- FWidget::~FWidget() // destructor { + delCallbacks(); processDestroy(); - FApplication::removeQueuedEvent(this); if ( this == getClickedWidget() ) @@ -1121,6 +1121,14 @@ void FWidget::delCallback (FWidget* cb_instance) } } +//---------------------------------------------------------------------- +inline void FWidget::delCallbacks() +{ + // delete all callbacks from this widget + memberCallbackObjects.clear(); // member function pointer + callbackObjects.clear(); // function pointer +} + //---------------------------------------------------------------------- void FWidget::emitCallback (FString emit_signal) { diff --git a/src/fwidget.h b/src/fwidget.h index 8bc7de58..c028ad2c 100644 --- a/src/fwidget.h +++ b/src/fwidget.h @@ -352,6 +352,7 @@ class FWidget : public FObject, public FTerm , void* = null ); void delCallback (FCallback); void delCallback (FWidget*); + void delCallbacks(); void emitCallback (FString); void addAccelerator (int);