switched from raw to QScopedPointer pointer in mupp.cpp.
This commit is contained in:
parent
e26fa4eea2
commit
e5ff0fa743
@ -548,11 +548,11 @@ int main(int argc, char *argv[])
|
||||
if (script.size() > 0) { // script
|
||||
guiFlag = false;
|
||||
}
|
||||
QCoreApplication *app = createApplication(argc, argv, guiFlag);
|
||||
QScopedPointer<QCoreApplication> app(createApplication(argc, argv, guiFlag));
|
||||
|
||||
std::unique_ptr<PmuppGui> gui;
|
||||
std::unique_ptr<PmuppScript> mupp_script;
|
||||
if (qobject_cast<QApplication *>(app)) { // GUI
|
||||
if (qobject_cast<QApplication *>(app.get())) { // GUI
|
||||
gui = std::make_unique<PmuppGui>(fln);
|
||||
if (gui == nullptr) {
|
||||
std::cerr << std::endl;
|
||||
@ -565,8 +565,8 @@ int main(int argc, char *argv[])
|
||||
gui->resize( 800, 500 );
|
||||
gui->show();
|
||||
|
||||
app->connect( app, SIGNAL( lastWindowClosed() ), app, SLOT( quit() ) );
|
||||
app->connect( app, SIGNAL( aboutToQuit() ), gui.get(), SLOT( aboutToQuit() ) );
|
||||
app.get()->connect( app.get(), SIGNAL( lastWindowClosed() ), app.get(), SLOT( quit() ) );
|
||||
app.get()->connect( app.get(), SIGNAL( aboutToQuit() ), gui.get(), SLOT( aboutToQuit() ) );
|
||||
} else { // scripting
|
||||
mupp_script = std::make_unique<PmuppScript>(script);
|
||||
if (mupp_script == nullptr) {
|
||||
@ -578,7 +578,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// This will cause the application to exit when the task signals finished.
|
||||
QObject::connect( mupp_script.get(), SIGNAL( finished() ), app, SLOT( quit() ) );
|
||||
QObject::connect( mupp_script.get(), SIGNAL( finished() ), app.get(), SLOT( quit() ) );
|
||||
|
||||
// This will run the task from the application event loop.
|
||||
QTimer::singleShot(0, mupp_script.get(), SLOT( executeScript() ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user