summaryrefslogtreecommitdiff
path: root/core/launcher/systray.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/systray.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/systray.cpp8
1 files changed, 8 insertions, 0 deletions
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
@@ -48,48 +48,56 @@ SysTray::~SysTray()
{
clearApplets();
}
static int compareAppletPositions(const void *a, const void *b)
{
const TaskbarApplet* aa = *(const TaskbarApplet**)a;
const TaskbarApplet* ab = *(const TaskbarApplet**)b;
int d = ab->iface->position() - aa->iface->position();
if ( d ) return d;
return QString::compare(ab->name,aa->name);
}
void SysTray::loadApplets()
{
hide();
clearApplets();
addApplets();
}
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<TaskbarApplet>::Iterator mit;
for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
(*mit).iface->release();
(*mit).library->unload();
delete (*mit).library;
}
#endif
appletList.clear();
if ( layout )
delete layout;
layout = new QHBoxLayout( this, 0, 1 );
layout->setAutoAdd(TRUE);
}
void SysTray::addApplets()
{
hide();
#ifndef QT_NO_COMPONENTS
Config cfg( "Taskbar" );
cfg.setGroup( "Applets" );
QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
QString lang = getenv( "LANG" );