summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/tools/quicklauncher/main.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp
index b1befce..fb2ca44 100644
--- a/core/tools/quicklauncher/main.cpp
+++ b/core/tools/quicklauncher/main.cpp
@@ -74,16 +74,17 @@ void setproctitle (const char *fmt,...) {
(void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap);
va_end(ap);
i = strlen (buf);
if (i > argv_lth - 2) {
i = argv_lth - 2;
buf[i] = '\0';
}
+
memset(argv0[0], '\0', argv_lth); /* clear the memory area */
(void) strcpy (argv0[0], buf);
argv0[1] = NULL;
}
#endif
@@ -106,16 +107,17 @@ public:
int sep = appName.findRev( '/' );
if ( sep > 0 )
appName = appName.mid( sep+1 );
appIface = 0;
if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) {
mainWindow = appIface->createMainWindow( appName );
}
+
if ( mainWindow ) {
if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) {
app->showMainDocumentWidget( mainWindow );
} else {
app->showMainWidget( mainWindow );
}
} else {
owarn << "Could not create application main window" << oendl;
@@ -149,20 +151,22 @@ private slots:
}
}
private:
void doQuickLaunch( QStrList &argList )
{
static int myargc = argList.count();
static char **myargv = new char *[myargc + 1];
+
for ( int j = 0; j < myargc; j++ ) {
myargv[j] = new char [strlen(argList.at(j))+1];
strcpy( myargv[j], argList.at(j) );
}
+
myargv[myargc] = NULL;
#ifdef _OS_LINUX_
// Change name of process
setproctitle(myargv[0]);
#endif
connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit()));
app->exit_loop();
@@ -179,18 +183,20 @@ int main( int argc, char** argv )
app = new QPEApplication( argc, argv );
loader = new PluginLoader( "application" );
unsetenv( "LD_BIND_NOW" );
QCString arg0 = argv[0];
int sep = arg0.findRev( '/' );
+
if ( sep > 0 )
arg0 = arg0.mid( sep+1 );
+
if ( arg0 != "quicklauncher" ) {
odebug << "QuickLauncher invoked as: " << arg0.data() << oendl;
QuickLauncher::exec( argc, argv );
} else {
#ifdef _OS_LINUX_
// Setup to change proc title
int i;
char **envp = environ;
@@ -220,21 +226,16 @@ int main( int argc, char** argv )
QFont f( QApplication::font() );
f.setWeight( QFont::Bold );
QFontMetrics fmb( f );
fmb.ascent(); // causes font load.
// Each of the following force internal structures/internal
// initialization to be performed. This may mean allocating
// memory that is not needed by all applications.
-#if 0
- TimeZone::current().isValid(); // popuplate timezone cache
- TimeString::currentDateFormat(); // create internal structures
- TimeString::currentAMPM();
-#endif
Resource::loadIconSet("new"); // do internal init
/* make sure libopie gets lined in */
{
Opie::Ui::OWait item;
}
// Create a widget to force initialization of title bar images, etc.
@@ -246,21 +247,23 @@ int main( int argc, char** argv )
app->enter_loop();
}
int rv = app->exec();
if ( mainWindow )
delete (QWidget*)mainWindow;
-
delete app;
+
if ( appIface )
loader->releaseInterface( appIface );
delete loader;
+
+
// Neither QLibrary nor my Dropin is a QObject and they don't depend
// on a qApp so we destroy QWidget::destroyMapper() without
// crashing the app
//
// The problem is there are some 'static' resources not freed
// in the apps and on destructing these objects are not available
// anymore. In future fix up the apps but for now
// we just skip deletion and hope things go well -zecke