summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-21 03:15:36 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-21 03:15:36 (GMT)
commit81a3f8e7c11c69b2390582c768f1020e233d14cf (patch)
treeb89f0f2c7690a3d46f1828c9168f192d8bce1394 /tools
parentba01ed76ce4e8245378ba0d5a46ebef77fe6984d (diff)
downloadQt-81a3f8e7c11c69b2390582c768f1020e233d14cf.zip
Qt-81a3f8e7c11c69b2390582c768f1020e233d14cf.tar.gz
Qt-81a3f8e7c11c69b2390582c768f1020e233d14cf.tar.bz2
delete the viewer before calling exit(). Ensures correct cleanup.
Diffstat (limited to 'tools')
-rw-r--r--tools/qml/main.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index e90d729..cba5650 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -347,7 +347,7 @@ int main(int argc, char ** argv)
}
#endif
- QDeclarativeViewer viewer(0, wflags);
+ QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
if (!scriptopts.isEmpty()) {
QStringList options =
scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts);
@@ -383,45 +383,45 @@ int main(int argc, char ** argv)
if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play))
scriptOptsUsage();
- viewer.setScriptOptions(scriptOptions);
- viewer.setScript(script);
+ viewer->setScriptOptions(scriptOptions);
+ viewer->setScript(script);
} else if (!script.isEmpty()) {
usage();
}
- viewer.addLibraryPath(QCoreApplication::applicationDirPath());
+ viewer->addLibraryPath(QCoreApplication::applicationDirPath());
foreach (QString lib, imports)
- viewer.addLibraryPath(lib);
+ viewer->addLibraryPath(lib);
foreach (QString plugin, plugins)
- viewer.addPluginPath(plugin);
+ viewer->addPluginPath(plugin);
- viewer.setNetworkCacheSize(cache);
- viewer.setRecordFile(recordfile);
- viewer.setSizeToView(sizeToView);
+ viewer->setNetworkCacheSize(cache);
+ viewer->setRecordFile(recordfile);
+ viewer->setSizeToView(sizeToView);
if (resizeview)
- viewer.setScaleView();
+ viewer->setScaleView();
if (fps>0)
- viewer.setRecordRate(fps);
+ viewer->setRecordRate(fps);
if (autorecord_to)
- viewer.setAutoRecord(autorecord_from,autorecord_to);
+ viewer->setAutoRecord(autorecord_from,autorecord_to);
if (!skin.isEmpty()) {
if (skin == "list") {
- foreach (QString s, viewer.builtinSkins())
+ foreach (QString s, viewer->builtinSkins())
qWarning() << qPrintable(s);
exit(0);
} else {
- viewer.setSkin(skin);
+ viewer->setSkin(skin);
}
}
if (devkeys)
- viewer.setDeviceKeys(true);
- viewer.setRecordDither(dither);
+ viewer->setDeviceKeys(true);
+ viewer->setRecordDither(dither);
if (recordargs.count())
- viewer.setRecordArgs(recordargs);
+ viewer->setRecordArgs(recordargs);
- viewer.setUseNativeFileBrowser(useNativeFileBrowser);
+ viewer->setUseNativeFileBrowser(useNativeFileBrowser);
if (fullScreen && maximized)
qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen.";
@@ -440,17 +440,19 @@ int main(int argc, char ** argv)
}
if (!fileName.isEmpty()) {
- viewer.open(fileName);
- fullScreen ? viewer.showFullScreen() : maximized ? viewer.showMaximized() : viewer.show();
+ viewer->open(fileName);
+ fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show();
} else {
if (!useNativeFileBrowser)
- viewer.openFile();
- fullScreen ? viewer.showFullScreen() : maximized ? viewer.showMaximized() : viewer.show();
+ viewer->openFile();
+ fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show();
if (useNativeFileBrowser)
- viewer.openFile();
+ viewer->openFile();
}
- viewer.setUseGL(useGL);
- viewer.raise();
+ viewer->setUseGL(useGL);
+ viewer->raise();
- exit(app.exec());
+ int rv = app.exec();
+ delete viewer;
+ exit(rv);
}