From 3958c53cb34384a143baf18829fcf94edf3adfa5 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 11 Sep 2012 11:12:02 +0200 Subject: [PATCH] Fix issue with Python debugger when leaving application --- src/Gui/PythonConsole.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 07a7809ed..8c5d2cea9 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1228,16 +1228,18 @@ void PythonConsole::onCopyCommand() QString PythonConsole::readline( void ) { - QEventLoop loop; - QString inputBuffer; + QEventLoop loop; + QString inputBuffer; - printPrompt( PythonConsole::Special ); - this->_sourceDrain = &inputBuffer; //< enable source drain ... + printPrompt( PythonConsole::Special ); + this->_sourceDrain = &inputBuffer; //< enable source drain ... // ... and wait until we get notified about pendingSource QObject::connect( this, SIGNAL(pendingSource()), &loop, SLOT(quit()) ); - loop.exec(); - this->_sourceDrain = NULL; //< disable source drain - return inputBuffer.append(QChar::fromAscii('\n')); //< pass a newline here, since the readline-caller may need it! + // application is about to quit + if (loop.exec() < 0) + inputBuffer = QLatin1String("quit()"); + this->_sourceDrain = NULL; //< disable source drain + return inputBuffer.append(QChar::fromAscii('\n')); //< pass a newline here, since the readline-caller may need it! } // ---------------------------------------------------------------------