From 3038503f6ffc2d58b00650d5feae23cc8e842bcb Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 03 Sep 2003 18:58:20 +0000 Subject: Failure free restart of the launcher and a comment why we do that --- (limited to 'core/launcher') diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index 522ef07..28316a4 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp @@ -723,9 +723,28 @@ void ServerApplication::shutdown( ShutdownImpl::Type t ) void ServerApplication::restart() { if ( allowRestart ) { + + /* + * Applets and restart is a problem. Some applets delete + * their widgets even if ownership gets transfered to the + * parent (Systray ) but deleting the applet may be unsafe + * as well ( double deletion ). Some have topLevel widgets + * and when we dlclose and then delete the widget we will + * crash and an crash during restart is not nice + */ +#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED + /* same as above */ + emit aboutToQuit(); prepareForTermination(TRUE); doRestart = TRUE; quit(); +#else + prepareForTermination( true ); + for ( int fd = 3; fd < 100; fd++ ) + close( fd ); + execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); + exit( 1 ); +#endif } } diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 64356ca..6122770 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp @@ -69,6 +69,14 @@ void SysTray::clearApplets() { #ifndef QT_NO_COMPONENTS + /* + * Note on clearing. SOme applets delete their + * applets themselves some don't do it + * and on restart this can crash. If we delete it + * here we might end up in a double deletion. We could + * use QGuardedPtr but that would be one QOBject + * for every applet more but only useful for restart + */ QValueList::Iterator mit; for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { (*mit).iface->release(); diff --git a/core/launcher/systray.h b/core/launcher/systray.h index 77c581f..b989d58 100644 --- a/core/launcher/systray.h +++ b/core/launcher/systray.h @@ -27,6 +27,7 @@ #include #include +#include class QHBoxLayout; class QLibrary; -- cgit v0.9.0.2