summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-01-11 12:47:01 +0100
committercon <qtc-committer@nokia.com>2010-01-11 16:19:45 +0100
commit94dc99fa64a50cea8f53c2338f81455fda1af5de (patch)
tree56ad7659885de3e37951fabeaec309fa6c7b8a90
parent8243986b9a65e2f9f76165be703f1cdb9f472d52 (diff)
downloadqt-creator-94dc99fa64a50cea8f53c2338f81455fda1af5de.tar.gz
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 (cherry picked from commit 2b46f828b4ae2f41c4efc9fde7e8b7c5e271b4de)
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp9
-rw-r--r--src/plugins/texteditor/basetextmark.cpp7
2 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index 4fc8c04010..116e732271 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -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()
diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp
index 0d50a7111e..cc64f152bf 100644
--- a/src/plugins/texteditor/basetextmark.cpp
+++ b/src/plugins/texteditor/basetextmark.cpp
@@ -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;
+ }
}
}
}