Commit ce65e9d7 authored by Daniel Teske's avatar Daniel Teske
Browse files

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: default avatarRobert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 697b2074
......@@ -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());
......
......@@ -230,6 +230,7 @@ private slots:
void updateActions();
void updateContext();
void runConfigurationConfigurationFinished();
void showRenameFileError();
#ifdef WITH_TESTS
void testAnsiFilterOutputParser_data();
......
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