forked from qt-creator/qt-creator
TextEditor: fix crash on activating bookmark in deleted file
since 23908b283e
bookmarks are opened on
double click. But double click also emits an activated. and both signals
are connected to gotoBookmark, so this slot got triggered twice. This is
problematic when the bookmark is not reachable anymore since the first
execution of gotoBookmark deletes unreachable bookmarks, and the second
execution has only a nullptr and passes it to functions not checking
this pointer.
Fixes: QTCREATORBUG-30283
Change-Id: Ia57d0469840d467af31fa5c89745c2ad33aa7e3f
Reviewed-by: Xavier BESSON (Personal) <developer@xavi-b.fr>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -306,10 +306,11 @@ void BookmarkView::removeAll()
|
||||
|
||||
void BookmarkView::gotoBookmark(const QModelIndex &index)
|
||||
{
|
||||
Bookmark *bk = m_manager->bookmarkForIndex(index);
|
||||
if (Bookmark *bk = m_manager->bookmarkForIndex(index)) {
|
||||
if (!m_manager->gotoBookmark(bk))
|
||||
m_manager->deleteBookmark(bk);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
// BookmarkManager
|
||||
|
Reference in New Issue
Block a user