added proper unregister calls in destructors of classes that register a event handler

This commit is contained in:
csoler 2020-01-31 22:37:21 +01:00
parent e6d16f6f39
commit 0cdce37af4
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
11 changed files with 20 additions and 0 deletions

View File

@ -1117,6 +1117,8 @@ void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
TransfersDialog::~TransfersDialog() TransfersDialog::~TransfersDialog()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
// save settings // save settings
processSettings(false); processSettings(false);
} }

View File

@ -1377,6 +1377,9 @@ void IdDialog::circle_selected()
IdDialog::~IdDialog() IdDialog::~IdDialog()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId_identity);
rsEvents->unregisterEventsHandler(mEventHandlerId_circles);
// save settings // save settings
processSettings(false); processSettings(false);

View File

@ -83,6 +83,7 @@ void PostedDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
PostedDialog::~PostedDialog() PostedDialog::~PostedDialog()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
} }
UserNotify *PostedDialog::createUserNotify(QObject *parent) UserNotify *PostedDialog::createUserNotify(QObject *parent)

View File

@ -266,6 +266,7 @@ void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> e)
NewFriendList::~NewFriendList() NewFriendList::~NewFriendList()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete ui; delete ui;
} }

View File

@ -88,6 +88,7 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
GxsChannelDialog::~GxsChannelDialog() GxsChannelDialog::~GxsChannelDialog()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
} }
QString GxsChannelDialog::getHelpString() const QString GxsChannelDialog::getHelpString() const

View File

@ -158,6 +158,7 @@ void GxsChannelPostsWidget::handleEvent_main_thread(std::shared_ptr<const RsEven
GxsChannelPostsWidget::~GxsChannelPostsWidget() GxsChannelPostsWidget::~GxsChannelPostsWidget()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
// save settings // save settings
processSettings(false); processSettings(false);

View File

@ -490,6 +490,7 @@ void GxsForumThreadWidget::blank()
GxsForumThreadWidget::~GxsForumThreadWidget() GxsForumThreadWidget::~GxsForumThreadWidget()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
// save settings // save settings
processSettings(false); processSettings(false);

View File

@ -83,6 +83,7 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
GxsForumsDialog::~GxsForumsDialog() GxsForumsDialog::~GxsForumsDialog()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
} }
QString GxsForumsDialog::getHelpString() const QString GxsForumsDialog::getHelpString() const

View File

@ -87,6 +87,7 @@ void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
HashingStatus::~HashingStatus() HashingStatus::~HashingStatus()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete(movie); delete(movie);
} }

View File

@ -45,6 +45,11 @@ RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *ifaceImpl) :
}, mEventHandlerId ); }, mEventHandlerId );
} }
RsGxsUpdateBroadcast::~RsGxsUpdateBroadcast()
{
rsEvents->unregisterEventsHandler(mEventHandlerId);
}
void RsGxsUpdateBroadcast::cleanup() void RsGxsUpdateBroadcast::cleanup()
{ {
QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it; QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it;

View File

@ -40,6 +40,9 @@ public:
static RsGxsUpdateBroadcast *get(RsGxsIfaceHelper* ifaceImpl); static RsGxsUpdateBroadcast *get(RsGxsIfaceHelper* ifaceImpl);
protected:
virtual ~RsGxsUpdateBroadcast();
signals: signals:
void changed(); void changed();
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta); void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);