summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-05-15 14:27:12 (GMT)
committerTobias Markmann <tm@ayena.de>2017-05-15 14:34:02 (GMT)
commit33f9a7682a9b40d141900aa7ce302a8e47d4d762 (patch)
tree288ddffe71fb0117bf8d0998c99df54c0d91deb3 /Swift/QtUI/Roster/QtFilterWidget.h
parentd93be16eb1bb43ba602fcd7398fc0e46084dbd7f (diff)
downloadswift-33f9a7682a9b40d141900aa7ce302a8e47d4d762.zip
swift-33f9a7682a9b40d141900aa7ce302a8e47d4d762.tar.bz2
Use QPointer to prevent access to potentially freed QtTreeWidget
As the QtTreeWidget and the QtFilterWidget are siblings in their parent widget, it might happen that the QtTreeWidget is deleted before the QtFilterWidget. Using Pointer, we are able to detect this case and can prevent accessing the already deleted QtTreeWidget. QtFilterWidget cannot be made the child of the QtTreeWidget in this case, so this fix uses the QPointers approach as a workaround. SWIFT-247 Test-Information: Tests pass and builds on macOS 10.12.4 with Qt 5.4.2. Change-Id: I3a60006519b580010718c4d2aa94638555c0afdf
Diffstat (limited to 'Swift/QtUI/Roster/QtFilterWidget.h')
-rw-r--r--Swift/QtUI/Roster/QtFilterWidget.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swift/QtUI/Roster/QtFilterWidget.h b/Swift/QtUI/Roster/QtFilterWidget.h
index ea3c325..85f607e 100644
--- a/Swift/QtUI/Roster/QtFilterWidget.h
+++ b/Swift/QtUI/Roster/QtFilterWidget.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2016 Isode Limited.
+ * Copyright (c) 2016-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -15,6 +15,7 @@
#include <vector>
#include <QBoxLayout>
+#include <QPointer>
#include <QWidget>
#include <Swift/Controllers/Roster/FuzzyRosterFilter.h>
@@ -46,7 +47,7 @@ class QtFilterWidget : public QWidget {
private:
QtClosableLineEdit* filterLineEdit_;
- QtTreeWidget* treeView_;
+ QPointer<QtTreeWidget> treeView_;
UIEventStream* eventStream_;
std::vector<RosterFilter*> filters_;
QAbstractItemModel* sourceModel_;