Commit 2b46f828 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer Committed by con
Browse files

Fixed crash when leaving session with invalid bookmarks or breakpoints

When the bookmark could not be added to the editor due to being on a
non-existing line, it would not be cleaned up properly when the editor
was closed, resulting in a crash when it later tried to remove itself
from the no longer existing editor.

In addition to fixing the crash, bookmarks that are not on valid lines
are now automatically removed when you try to navigate to them.

Task-number: QTCREATORBUG-545
Reviewed-by: mae
parent 8a6ca955
......@@ -485,11 +485,10 @@ Bookmark *BookmarkManager::bookmarkForIndex(QModelIndex index)
bool BookmarkManager::gotoBookmark(Bookmark* bookmark)
if (!TextEditor::BaseTextEditor::openEditorAt(bookmark->filePath(), bookmark->lineNumber())) {
// Could not open editor
return false;
return true;
using namespace TextEditor;
if (ITextEditor *editor = BaseTextEditor::openEditorAt(bookmark->filePath(), bookmark->lineNumber()))
return (editor->currentLine() == bookmark->lineNumber());
return false;
void BookmarkManager::nextInDocument()
......@@ -72,7 +72,12 @@ void BaseTextMark::editorOpened(Core::IEditor *editor)
if (m_markableInterface == 0) { // We aren't added to something
m_markableInterface = textEditor->markableInterface();
m_internalMark = new InternalMark(this);
m_markableInterface->addMark(m_internalMark, m_line);
if (!m_markableInterface->addMark(m_internalMark, m_line)) {
delete m_internalMark;
m_internalMark = 0;
m_markableInterface = 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment