-rw-r--r-- | core/tools/quicklauncher/main.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp index 59dd17e..72f574a 100644 --- a/core/tools/quicklauncher/main.cpp +++ b/core/tools/quicklauncher/main.cpp @@ -149,141 +149,141 @@ private slots: doQuickLaunch( argList ); delete this; } else if ( msg == "execute(QString)" ) { delete qlChannel; QDataStream stream( data, IO_ReadOnly ); QString arg; stream >> arg; odebug << "QuickLauncher execute: " << arg << oendl; QStrList argList; argList.append( arg.utf8() ); doQuickLaunch( argList ); delete this; } } 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]); prctl( PR_SET_NAME, (unsigned long)myargv[0], 0, 0, 0 ); #endif connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); app->exit_loop(); app->initApp( myargc, myargv ); exec( myargc, myargv ); } private: QCopChannel *qlChannel; }; int main( int argc, char** argv ) { app = new Opie::Core::OApplication( 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; /* Move the environment so we can reuse the memory. * (Code borrowed from sendmail.) */ for (i = 0; envp[i] != NULL; i++) continue; environ = (char **) malloc(sizeof(char *) * (i + 1)); if (environ == NULL) return -1; for (i = 0; envp[i] != NULL; i++) if ((environ[i] = strdup(envp[i])) == NULL) return -1; environ[i] = NULL; argv0 = argv; if (i > 0) argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; else argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; #endif (void)new QuickLauncher(); odebug << "QuickLauncher running" << oendl; // Pre-load default fonts QFontMetrics fm( QApplication::font() ); fm.ascent(); // causes font load. 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. - Resource::loadIconSet("new"); // do internal init + Resource::loadPixmap("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. QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); w->setGeometry( -100, -100, 10, 10 ); w->show(); QTimer::singleShot( 0, w, SLOT(close()) ); 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 // delete app; // hack instead -zecke // delete app->pidChannel; // app->pidChannel = 0; return rv; } #include "main.moc" |