Bug 164320

Summary: Systemtray icons disappear on panel resize
Product: [Unmaintained] plasma4 Reporter: FiNeX <finex>
Component: panelAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: alex, greg.martyn, humufr, mail, rdieter, stefan
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch to test what's going on there
patch that hopefully fixes the prob
2th try
systray wrong position
patch that fixes it

Description FiNeX 2008-06-17 19:16:07 UTC
Version:           Revision 821398 (using Devel)
Installed from:    Compiled sources
OS:                Linux

I've just compiled revision 821398.
I've started KDE4 with a clean user account and I've tried to resize the default panel. It crashed. Plasma restarted automatically and now I cannot reproduce the bug. After I'll try to do the test with a clean user account.

This is the backtrace:

Application: Plasma Workspace (plasma), signal SIGSEGV
[Thread debugging using libthread_db enabled]
[New Thread 0xb4b456f0 (LWP 32676)]
[New Thread 0xb10c6b90 (LWP 32679)]
[New Thread 0xb18c7b90 (LWP 32678)]
[New Thread 0xb302eb90 (LWP 32677)]
[KCrash handler]
#6  0xb68055f0 in QObject::connect (sender=0x9c811a0, 
    signal=0xb1cd2658 "2destroyed(QObject *)", receiver=0x9ef2590, 
    method=0xb1cd2638 "1relayoutContainers(QObject *)", 
    type=Qt::AutoConnection)
    at /home/test/KDE4/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:2369
#7  0xb1cd1b7c in SystemTrayWidget::x11Event (this=0x9ef2590, 
    event=0xbfe6b17c)
    at /home/test/KDE4/kdesvn/kdebase/workspace/plasma/applets/systemtray/systemtraywidget.cpp:95
#8  0xb60643d0 in QApplication::x11ProcessEvent (this=0x9c60c18, 
    event=0xbfe6b17c)
    at /home/test/KDE4/kdesvn/qt-copy/src/gui/kernel/qapplication_x11.cpp:3128
#9  0xb608aaec in x11EventSourceDispatch (s=0x9c698d8, callback=0, 
    user_data=0x0)
    at /home/test/KDE4/kdesvn/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:148
#10 0xb5ae5f88 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#11 0xb5ae94eb in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#12 0xb5ae9668 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#13 0xb681b678 in QEventDispatcherGlib::processEvents (this=0x9c634c0, flags=
      {i = -1075399880})
    at /home/test/KDE4/kdesvn/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp:325
#14 0xb608a2a5 in QGuiEventDispatcherGlib::processEvents (this=0x9c634c0, 
    flags={i = -1075399832})
    at /home/test/KDE4/kdesvn/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#15 0xb67f382a in QEventLoop::processEvents (this=0xbfe6b3d0, flags=
      {i = -1075399768})
    at /home/test/KDE4/kdesvn/qt-copy/src/corelib/kernel/qeventloop.cpp:149
#16 0xb67f39ea in QEventLoop::exec (this=0xbfe6b3d0, flags={i = -1075399720})
    at /home/test/KDE4/kdesvn/qt-copy/src/corelib/kernel/qeventloop.cpp:196
#17 0xb67f5c4d in QCoreApplication::exec ()
    at /home/test/KDE4/kdesvn/qt-copy/src/corelib/kernel/qcoreapplication.cpp:845
#18 0xb6001457 in QApplication::exec ()
    at /home/test/KDE4/kdesvn/qt-copy/src/gui/kernel/qapplication.cpp:3304
#19 0xb7f36921 in kdemain (argc=1, argv=0xbfe6b5a4)
    at /home/test/KDE4/kdesvn/kdebase/workspace/plasma/plasma/main.cpp:54
#20 0x080488e2 in main (argc=1, argv=0x2)
    at /home/test/KDE4/kdesvn/build/kdebase/workspace/plasma/plasma/plasma-qgv_dummy.cpp:3
#0  0xb7f4e424 in __kernel_vsyscall ()
Comment 1 FiNeX 2008-06-17 19:22:58 UTC
Moreover, after plasma has been restarted, icons (kmix and klipper) which were on the systray are placed on the top left corner of the screen.
Comment 2 FiNeX 2008-06-17 20:59:44 UTC
I've re-tried with a clean account and plasma crash the first time the panel is resized. After it doesn't crash anymore.
Comment 3 Sebastian Sauer 2008-06-17 21:24:31 UTC

*** This bug has been marked as a duplicate of 162765 ***
Comment 4 Sebastian Sauer 2008-06-17 21:29:24 UTC
ups, sorry. I did just note that the other report was closed meanwhile and probably also contains other cases. So, let's go the easy way to reopen this one and point also to the relevant reports bug #162765 and bug #821398 plus dozend of duplicates.
Comment 5 Sebastian Sauer 2008-06-17 21:31:33 UTC
another correction;
* bug #162765 and bug #160659 are related.
* all this still is part of #155381 aka "the neverending story, part I"
Comment 6 Sebastian Sauer 2008-06-17 21:37:31 UTC
ok, a guess;

systemtraywidget.cpp looks like this;

SystemTrayContainer *container = new SystemTrayContainer(this);
addWidgetToLayout(container);
emit sizeShouldChange();
connect(container, SIGNAL(destroyed(QObject *)), this, SLOT(relayoutContainers(QObject *))); //<== CRASHES

while the SystemTrayContainer ctor contains;

connect(this, SIGNAL(clientClosed()), SLOT(deleteLater()));

so... what *may* happen is, that the clientClosed() got fired up before the
connect(container, SIGNAL(destroyed(QObject *)), this, SLOT(relayoutContainers(QObject *))); was setup and therefore we end in a crash...
Comment 7 Sebastian Sauer 2008-06-17 21:44:03 UTC
Created attachment 25426 [details]
patch to test what's going on there

the guess has a few drawbacks like why should clientClosed() be called if we
didn't call embedClient() yet?!

Anyway, if you like could you please try to apply the attached patch which
should either invalidate or validate my guess - thanks in advance :)
Comment 8 Sebastian Sauer 2008-06-17 21:49:20 UTC
ah, no... it would even make sense if clientClosed() is called since with the 
emit sizeShouldChange(); 
the
updateWidgetGeometry()
got called which does acutaly a delete...

So, fix would be to move the
emit sizeShouldChange();
at the end of the SystemTrayWidget::x11Event() method...
Comment 9 Sebastian Sauer 2008-06-17 21:51:37 UTC
Created attachment 25428 [details]
patch that hopefully fixes the prob

Could you please try the attached patch? thx :)
Comment 10 FiNeX 2008-06-17 21:56:55 UTC
Yes, I'll try it now.
Comment 11 FiNeX 2008-06-17 22:00:00 UTC
Ok, with this patch I've got no crash. But all the icons on the systray disappeared (kmix and klipper).
I've started kwallet and its icon appeared on the systray.
Comment 12 Sebastian Sauer 2008-06-17 22:15:57 UTC
Created attachment 25429 [details]
2th try

At least the crash is gone :) Well, probably we should use the
clientIsEmbedded() signal to relayout at the correct time aka after the
embedding is done. Attached patch does this (it replaces the prev patch) and
since I am not able to reproduce neither the crash nor the layout-prob, it
would be great if you could give it a try again - thanks in advance :)
Comment 13 FiNeX 2008-06-17 22:58:47 UTC
Same as before: no crash and icons disappears :-(
Comment 14 Sebastian Sauer 2008-06-18 00:02:27 UTC
ok, since we have tagging tomorrow iirc I just committed the crash-fix with r821590 and what remains is the layout-bug (which I am still not able to reproduce, hmpf).
Comment 15 Sebastian Sauer 2008-06-18 00:03:15 UTC
crash=>normal
Comment 16 Sebastian Sauer 2008-06-18 01:53:54 UTC
*** Bug 160659 has been marked as a duplicate of this bug. ***
Comment 17 Anne-Marie Mahfouf 2008-06-18 09:19:33 UTC
*** Bug 164358 has been marked as a duplicate of this bug. ***
Comment 18 Sebastian Sauer 2008-06-21 21:08:09 UTC
re comment #11;
for a possible reason for this see http://bugs.kde.org/show_bug.cgi?id=164445#c14
Comment 19 Sebastian Sauer 2008-06-22 02:06:11 UTC
and commit r822917 fixes also the remaining layout-bug. Thanks to Jason for the hint and to FiNeX for the feedback! :)
Comment 20 Sebastian Sauer 2008-06-23 00:37:29 UTC
*** Bug 164667 has been marked as a duplicate of this bug. ***
Comment 21 Sebastian Sauer 2008-06-27 02:18:16 UTC
*** Bug 164983 has been marked as a duplicate of this bug. ***
Comment 22 FiNeX 2008-07-01 15:19:17 UTC
I reopen this report: using curren trunk (r826753) when I resize the panel the system tray disappear from the panel and after some seconds it appears on top-right corner, near the cashew.

I'll attach a screenshot.
Comment 23 FiNeX 2008-07-01 15:20:40 UTC
Created attachment 25769 [details]
systray wrong position

after resizing the panel, the systray disappear from the panel and appear on
the top right corner.
Comment 24 Sebastian Sauer 2008-07-01 15:26:50 UTC
sounds like a regression introduced with commit r826397, r826530 or r826594. "systray, the neverending story returns, part II" :-/
Comment 25 Sebastian Sauer 2008-07-01 15:54:43 UTC
Created attachment 25771 [details]
patch that fixes it

attached poatch fixes it by;
* delaying also the init() itself accordint to the setVisible and
* be sure we don't call startupDelayer() multiple times

but there is another new regression; if the panel is vertical then the icons
are not aligned horizontal any longer.
Comment 26 Sebastian Sauer 2008-07-01 22:17:57 UTC
fixed again with r826926 :) the "other new regression" seems to be actual a prob with the panel I've since today, so it's not related and probably already fixed. Thanks for the fast feedback, FiNeX! :)