Delete all callbacks from a widget, when it will be destroyed

This commit is contained in:
Markus Gans 2016-07-30 14:34:13 +02:00
parent 15793868fe
commit 9b7918f2f6
3 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,6 @@
2016-07-30 Markus Gans <guru.mail@muenster.de>
* Delete all callbacks from a widget, when it will be destroyed
2016-07-28 Markus Gans <guru.mail@muenster.de> 2016-07-28 Markus Gans <guru.mail@muenster.de>
* Improvements for the window focus * Improvements for the window focus

View File

@ -103,8 +103,8 @@ FWidget::FWidget (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget::~FWidget() // destructor FWidget::~FWidget() // destructor
{ {
delCallbacks();
processDestroy(); processDestroy();
FApplication::removeQueuedEvent(this); FApplication::removeQueuedEvent(this);
if ( this == getClickedWidget() ) 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) void FWidget::emitCallback (FString emit_signal)
{ {

View File

@ -352,6 +352,7 @@ class FWidget : public FObject, public FTerm
, void* = null ); , void* = null );
void delCallback (FCallback); void delCallback (FCallback);
void delCallback (FWidget*); void delCallback (FWidget*);
void delCallbacks();
void emitCallback (FString); void emitCallback (FString);
void addAccelerator (int); void addAccelerator (int);