summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-09-19 20:34:31 (GMT)
committerTobias Markmann <tm@ayena.de>2014-09-20 10:48:55 (GMT)
commit49535506a9c8002baf27da3de629326e57982f44 (patch)
treee4b647cde5eaf52142e2b144ab1955d792c34ba1 /Swift/QtUI/ChatList/ChatListModel.h
parentdbdd30aa0d94c79742a602908890548030088bc9 (diff)
downloadswift-49535506a9c8002baf27da3de629326e57982f44.zip
swift-49535506a9c8002baf27da3de629326e57982f44.tar.bz2
Fix ASAN-reported heap-use-after-free bug.
ChatListModel used to notify Qt about its changed items via layoutChanged() signals. However, not only the layout changed but most times also the items and corrosponding QModelIndex objects and their internal pointers. After layout changed Qt tried to access now invalid QModelIndex objects and their internal pointers pointed to freed memory. Test-Information: Checked via ASAN. The previously perfect reproducable report by joining a MUC from the bookmarks went away. Change-Id: I71d2aa7e66a6b4caf2a9e0f68552ff5174291e1e License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/QtUI/ChatList/ChatListModel.h')
-rw-r--r--Swift/QtUI/ChatList/ChatListModel.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Swift/QtUI/ChatList/ChatListModel.h b/Swift/QtUI/ChatList/ChatListModel.h
index a15cbcd..00bd5eb 100644
--- a/Swift/QtUI/ChatList/ChatListModel.h
+++ b/Swift/QtUI/ChatList/ChatListModel.h
@@ -7,7 +7,7 @@
#pragma once
#include <QAbstractItemModel>
-#include <QList>
+#include <QPersistentModelIndex>
#include <Swiften/MUC/MUCBookmark.h>
#include <Swift/Controllers/UIInterfaces/ChatListWindow.h>
@@ -38,6 +38,10 @@ namespace Swift {
ChatListGroupItem* recents_;
ChatListGroupItem* whiteboards_;
ChatListGroupItem* root_;
+
+ QPersistentModelIndex mucBookmarksIndex_;
+ QPersistentModelIndex recentsIndex_;
+ QPersistentModelIndex whiteboardsIndex_;
};
}