summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@theqtcompany.com>2014-11-17 18:18:01 +0100
committerDaniel Teske <daniel.teske@theqtcompany.com>2014-11-18 12:25:11 +0100
commitce65e9d73939d4bef6b041d820290833c39d1330 (patch)
treef5abeb317b5b7854f94840d3a5675e1ede6f787a
parent697b2074d3354bf5410ded5e8e0932428d892a00 (diff)
downloadqt-creator-ce65e9d73939d4bef6b041d820290833c39d1330.tar.gz
ProjectExplorer: Fix crash on renaming
Nested event loops rearing its ugly head. Avoid all the trouble by opening the message box on the next iteration of the event loop. Task-number: QTCREATORBUG-13428 Change-Id: I3c06d649464c34875da9601fb2e13227a0397836 Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp17
-rw-r--r--src/plugins/projectexplorer/projectexplorer.h1
2 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 090aa2ab0f..a804eadec8 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -294,6 +294,7 @@ public:
bool m_ignoreDocumentManagerChangedFile;
QStringList m_arguments;
QList<ProjectPanelFactory *> m_panelFactories;
+ QString m_renameFileError;
};
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
@@ -3265,11 +3266,12 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
FolderNode *folderNode = node->parentFolderNode();
QString projectDisplayName = folderNode->projectNode()->displayName();
if (!folderNode->renameFile(orgFilePath, newFilePath)) {
- QMessageBox::warning(ICore::mainWindow(), tr("Project Editing Failed"),
- tr("The file %1 was renamed to %2, but the project file %3 could not be automatically changed.")
- .arg(orgFilePath)
- .arg(newFilePath)
- .arg(projectDisplayName));
+ dd->m_renameFileError = tr("The file %1 was renamed to %2, but the project file %3 could not be automatically changed.")
+ .arg(orgFilePath)
+ .arg(newFilePath)
+ .arg(projectDisplayName);
+
+ QTimer::singleShot(0, m_instance, SLOT(showRenameFileError()));
} else {
dd->setCurrent(SessionManager::projectForFile(newFilePath), newFilePath, 0);
}
@@ -3281,6 +3283,11 @@ void ProjectExplorerPlugin::setStartupProject()
setStartupProject(dd->m_currentProject);
}
+void ProjectExplorerPlugin::showRenameFileError()
+{
+ QMessageBox::warning(ICore::mainWindow(), tr("Project Editing Failed"), dd->m_renameFileError);
+}
+
void ProjectExplorerPlugin::populateOpenWithMenu()
{
DocumentManager::populateOpenWithMenu(dd->m_openWithMenu, currentNode()->path());
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index b7ad5851a2..5ab8e7adf1 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -230,6 +230,7 @@ private slots:
void updateActions();
void updateContext();
void runConfigurationConfigurationFinished();
+ void showRenameFileError();
#ifdef WITH_TESTS
void testAnsiFilterOutputParser_data();