Editor: Fix crash on navigate back

Task-number: QTCREATORBUG-8080

Change-Id: I782fbdda6b2ec46b7b8f4f3e84855b99d1847e7d
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
David Schulz
2012-10-23 13:07:57 +02:00
parent e29f800c07
commit 2ddd0251b4

View File

@@ -413,11 +413,12 @@ void EditorView::goBackInNavigationHistory()
while (m_currentNavigationHistoryPosition > 0) { while (m_currentNavigationHistoryPosition > 0) {
--m_currentNavigationHistoryPosition; --m_currentNavigationHistoryPosition;
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition); EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
IEditor *editor; IEditor *editor = 0;
if (location.document) { if (location.document) {
editor = em->activateEditorForDocument(this, location.document, editor = em->activateEditorForDocument(this, location.document,
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch); EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
} else { }
if (!editor) {
editor = em->openEditor(this, location.fileName, location.id, editor = em->openEditor(this, location.fileName, location.id,
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch); EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
if (!editor) { if (!editor) {
@@ -439,11 +440,12 @@ void EditorView::goForwardInNavigationHistory()
return; return;
++m_currentNavigationHistoryPosition; ++m_currentNavigationHistoryPosition;
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition); EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
IEditor *editor; IEditor *editor = 0;
if (location.document) { if (location.document) {
editor = em->activateEditorForDocument(this, location.document, editor = em->activateEditorForDocument(this, location.document,
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch); EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
} else { }
if (!editor) {
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory); editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
if (!editor) { if (!editor) {
//TODO //TODO