From 1b6a9f488560c60bfb805d203288fc2a1fd6b4cd Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Wed, 8 Mar 2017 10:59:40 +0100 Subject: [PATCH] Fix crash when rendering from command line and no write access to config file (#3413) * Fix crash when rendering from command line and no write access to config file * Remove redundant call to ConfigManager::addRecentlyOpenedProject() --- src/core/ConfigManager.cpp | 23 +++++++++++++++-------- src/gui/MainWindow.cpp | 1 - 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 5cb46d9db..0db58a59c 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -547,14 +547,21 @@ void ConfigManager::saveConfigFile() QFile outfile( m_lmmsRcFile ); if( !outfile.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) { - QMessageBox::critical( NULL, - MainWindow::tr( "Could not save config-file" ), - MainWindow::tr( "Could not save configuration file %1. " - "You're probably not permitted to " - "write to this file.\n" - "Please make sure you have write-" - "access to the file and try again." ). - arg( m_lmmsRcFile ) ); + QString title, message; + title = MainWindow::tr( "Could not open file" ); + message = MainWindow::tr( "Could not open file %1 " + "for writing.\nPlease make " + "sure you have write " + "permission to the file and " + "the directory containing the " + "file and try again!" + ).arg( m_lmmsRcFile ); + if( gui ) + { + QMessageBox::critical( NULL, title, message, + QMessageBox::Ok, + QMessageBox::NoButton ); + } return; } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index f5c603c77..3ed4a988e 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -922,7 +922,6 @@ void MainWindow::openRecentlyOpenedProject( QAction * _action ) const QString & f = _action->text(); setCursor( Qt::WaitCursor ); Engine::getSong()->loadProject( f ); - ConfigManager::inst()->addRecentlyOpenedProject( f ); setCursor( Qt::ArrowCursor ); } runAutoSave();