From 462bda610e946c9519c0d8453d207075a223a82c Mon Sep 17 00:00:00 2001 From: Lorenz Haas Date: Sat, 13 Apr 2013 23:42:40 +0200 Subject: [PATCH] Bookmarks: Fix loose bookmarks while loading file The problem was, that while loading saved bookmarks, updateBookmark() was called which automatically called saveBookmarks() even if the pointer of the new bookmark was not put into m_bookmarksList. Thus the bookmark was deleted. Task-number: QTCREATORBUG-9116 Change-Id: I9cbdfc854e2bfa0dc448d96233ca76ee62417fe2 Reviewed-by: Eike Ziller --- src/plugins/bookmarks/bookmarkmanager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index fe2f37ce22f..642da498469 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -432,7 +432,10 @@ void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber) void BookmarkManager::updateBookmark(Bookmark *bookmark) { - int idx = m_bookmarksList.indexOf(bookmark); + const int idx = m_bookmarksList.indexOf(bookmark); + if (idx == -1) + return; + emit dataChanged(index(idx, 0, QModelIndex()), index(idx, 2, QModelIndex())); saveBookmarks(); }