summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-05-15 09:19:12 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-05-15 10:09:59 (GMT)
commitd93be16eb1bb43ba602fcd7398fc0e46084dbd7f (patch)
treed179b69f67fcfbdebba202a96bab1f6ac08cd84f
parent24baaf8ad66354c17a6d6ba4438e95d6798564a8 (diff)
downloadswift-d93be16eb1bb43ba602fcd7398fc0e46084dbd7f.zip
swift-d93be16eb1bb43ba602fcd7398fc0e46084dbd7f.tar.bz2
Unregister as event filter in QtFilterWidget dtor
When QtFilterWidget is deleted, it is still registered as event filter and events might be sent to an already deleted QtFilterWidget, causing a crash. SWIFT-247 Test-Information: All unit tests pass, roster filtering still works, and Swift does not crash on exit on macOS 10.12.4 with Qt 5.4.2. Change-Id: I84a7e1af64d1376db3dfdd0fd7cf95b547cca9a1
-rw-r--r--Swift/QtUI/Roster/QtFilterWidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Swift/QtUI/Roster/QtFilterWidget.cpp b/Swift/QtUI/Roster/QtFilterWidget.cpp
index 2e1ead9..4df4a39 100644
--- a/Swift/QtUI/Roster/QtFilterWidget.cpp
+++ b/Swift/QtUI/Roster/QtFilterWidget.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -42,13 +42,14 @@ QtFilterWidget::QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventS
layout->insertWidget(targetIndex, this);
filterLineEdit_->installEventFilter(this);
- treeView->installEventFilter(this);
+ treeView_->installEventFilter(this);
sourceModel_ = treeView_->model();
}
QtFilterWidget::~QtFilterWidget() {
-
+ filterLineEdit_->removeEventFilter(this);
+ treeView_->removeEventFilter(this);
}
bool QtFilterWidget::eventFilter(QObject*, QEvent* event) {