Skip to content
Snippets Groups Projects
Commit 564a937e authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Fixed crash when SessionItem is deleted while widget is hidden

parent c4e0982f
No related branches found
No related tags found
No related merge requests found
...@@ -74,8 +74,11 @@ void SessionItemWidget::subscribe() ...@@ -74,8 +74,11 @@ void SessionItemWidget::subscribe()
void SessionItemWidget::unsubscribe() void SessionItemWidget::unsubscribe()
{ {
if (m_currentItem) if (m_currentItem) {
m_currentItem->mapper()->unsubscribe(this); m_currentItem->mapper()->unsubscribe(this);
// should keep setOnItemDestroy alive to track item destruction while widget is hidden
m_currentItem->mapper()->setOnItemDestroy([this](SessionItem*) { m_currentItem = 0; }, this);
}
unsubscribeFromItem(); unsubscribeFromItem();
......
...@@ -58,8 +58,7 @@ public slots: ...@@ -58,8 +58,7 @@ public slots:
protected: protected:
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
void contextMenuEvent(QContextMenuEvent*); void contextMenuEvent(QContextMenuEvent*);
virtual void subscribeToItem(); void subscribeToItem();
virtual void unsubscribeFromItem();
private slots: private slots:
void onPropertyChanged(const QString& property_name); void onPropertyChanged(const QString& property_name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment