Bug 209271 - (patch) Plasma crashes on an X11-display without RENDER extension
Summary: (patch) Plasma crashes on an X11-display without RENDER extension
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-systemtray (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-03 07:49 UTC by Rich Johnson
Modified: 2009-10-15 04:43 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Johnson 2009-10-03 07:49:37 UTC
Version:            (using KDE 4.3.1)
OS:                Linux
Installed from:    Ubuntu Packages

I am copying the report as filed in Launchpad bug https://bugs.launchpad.net/bugs/397374.
-------------------------------------------

On Kubuntu-9.04, "plasma" crashes when starting it on an X11-display which does not support the RENDER extension ( such as the nested desktop in DemoRecorder, or maybe also Xnest ).

The source package containing this problem is kdebase-workspace_4.2.2-0ubuntu2

Here is the fix as a diff:
=============================================
--- kdebase-workspace-4.2.2-before-patch-by-clinhart/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.cpp 2009-01-06 18:22:29.000000000 +0100
+++ kdebase-workspace-4.2.2-0ubuntu2patch-from-demorec/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.cpp 2009-06-26 07:22:40.000000000 +0200
@@ -274,7 +274,8 @@
                                       &templ, &nvi);
     for (int i = 0; i < nvi; i++) {
         XRenderPictFormat *format = XRenderFindVisualFormat(d->display, xvi[i].visual);
- if (format->type == PictTypeDirect && format->direct.alphaMask) {
+ //patch by clinhart 20090705 to avoid crash with X11-Displays without Render-extension
+ if (format && format->type == PictTypeDirect && format->direct.alphaMask) {
             visual = xvi[i].visualid;
             break;
         }
=============================================

The problem is that "format" is a NULL-ptr when there is no RENDER extension.
I have added a NULL-ptr check before it is dereferenced, therefore fixing the crash.

Here's the backtrace:
=============================================
[KCrash Handler]
#6 SystemTray::FdoSelectionManager::initSelection (this=0xa074320) at /build/buildd/kdebase-workspace-4.2.2/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.cpp:277
#7 0xa983c5cb in SystemTray::FdoSelectionManager::qt_metacall (this=0xa074320, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbfe79218)
    at /build/buildd/kdebase-workspace-4.2.2/obj-i486-linux-gnu/plasma/applets/systemtray/moc_fdoselectionmanager.cpp:79
#8 0xb66a7ca8 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#9 0xb66a8932 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#10 0xb66ad0a7 in ?? () from /usr/lib/libQtCore.so.4
#11 0xb66ad1cc in ?? () from /usr/lib/libQtCore.so.4
#12 0xb66a215f in QObject::event () from /usr/lib/libQtCore.so.4
#13 0xb693ef2c in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#14 0xb694722e in QApplication::notify () from /usr/lib/libQtGui.so.4
#15 0xb779794d in KApplication::notify () from /usr/lib/libkdeui.so.5
#16 0xb6691a3b in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#17 0xb66c0d71 in ?? () from /usr/lib/libQtCore.so.4
#18 0xb66bd4e0 in ?? () from /usr/lib/libQtCore.so.4
#19 0xb4ff4b88 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#20 0xb4ff80eb in ?? () from /usr/lib/libglib-2.0.so.0
#21 0xb4ff8268 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#22 0xb66bd438 in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#23 0xb69e03f5 in ?? () from /usr/lib/libQtGui.so.4
#24 0xb669006a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#25 0xb66904aa in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#26 0xb6692959 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#27 0xb693eda7 in QApplication::exec () from /usr/lib/libQtGui.so.4
#28 0xb800db56 in kdemain (argc=1, argv=0xbfe79a74) at /build/buildd/kdebase-workspace-4.2.2/plasma/shells/desktop/main.cpp:54
#29 0x08048712 in main (argc=) at /build/buildd/kdebase-workspace-4.2.2/obj-i486-linux-gnu/plasma/shells/desktop/plasma_qgv_dummy.cpp:3
=============================================

If you have any questions regarding this please tell me and I'll be glad to answer them.

If you need to test it with DemoRecorder, you simply can download it from
http://demorecorder.com/download/download_trial_links.php?nn=1
(just install. No license needed for the reproduction tests...
"plasma" is automatically started when you start "demorec" )
I can also do the testing for you, once you have integrated the fix...
Comment 1 Dario Andres 2009-10-03 18:11:55 UTC
Mh, The systemtray component has changed a lot in 4.3 and 4.4; I wonder if the  bug/fix are still valid.
Thanks for the detailed explanation and patch.
Comment 2 Aaron J. Seigo 2009-10-15 04:43:48 UTC
SVN commit 1035441 by aseigo:

don't crash when we get a null pointer back, e.g. no render extension available
patch by clinhart
BUG:209271


 M  +1 -1      fdoselectionmanager.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1035441