Bug 204997 - Python plasmoid causes segfault
Summary: Python plasmoid causes segfault
Status: RESOLVED WORKSFORME
Alias: None
Product: plasma4
Classification: Plasma
Component: scriptengines (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-24 19:46 UTC by Ronuk Raval
Modified: 2010-05-14 03:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Small Plasmoid to demonstrate segfault (1.24 KB, application/octet-stream)
2009-08-26 23:47 UTC, Ronuk Raval
Details
Plasmoid demonstrating workaround (1.31 KB, application/zip)
2009-12-29 23:54 UTC, Ronuk Raval
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ronuk Raval 2009-08-24 19:46:39 UTC
Version:            (using KDE 4.3.0)
Compiler:          GCC 4.4.1, Python 2.6.2 
OS:                Linux
Installed from:    Unlisted Binary Package

I'm writing a dataengine[1] and plasmoid[2] pair in Python, that for some reason causes plasmoidviewer (and plasma-desktop) to segfault. I can assert that the dataengine is not the problem, since commenting out the connection of the engine to the plasmoid still causes the crash. plasmaengineexplorer also has no problems dealing with the engine.

On a side note, as I'm unsure of the relevancy of this tidbit, but to aid in debugging this crash, I added simple print statements to end of my methods to figure out order of execution (a "created!" at the end of init(), and an "update!" at the end of dataUpdated()). Turns out that dataUpdated() is called /before/ init(). Is this the expected behaviour?

Code can be found on Launchpad:
[1] dataengine - http://bazaar.launchpad.net/~ronuk-raval/wicd/wicd-dataengine/files
[2] plasmoid - http://bazaar.launchpad.net/~ronuk-raval/wicd/wicd-plasmoid/files

-- Information:
Application that crashed: plasmoidviewer
Version of the application: 1.0
KDE Version: 4.3.00 (KDE 4.3.0)
Qt Version: 4.5.2
Operating System: Linux 2.6.30-ARCH i686 (Arch Linux)

-- Running plasmoidviewer for the applet:
[rraval@enthalpy]$ plasmoidviewer plasma-applet-wicd
plasmoidviewer(4245)/plasma main: setting FormFactor to "planar"                 
plasmoidviewer(4245)/plasma main: setting Location to "floating"
plasmoidviewer(4245)/plasma main: setting containment to "null"
plasmoidviewer(4245)/plasma FullView::addApplet: adding applet "plasma-applet-wicd" in "null"
plasmoidviewer(4245)/libplasma Plasma::CoronaPrivate::addContainment: loading of containment "null" failed.
plasmoidviewer(4245)/libplasma Plasma::AppletPrivate::init: Check your constructor!  You probably want to be passing in a Service::Ptr  or a QVariantList with a valid storageid as arg[0].
plasmoidviewer(4245)/libplasma Plasma::Applet::load: we have a script using the "python" API
plasmoidviewer(4245)/libplasma Plasma::AppletPrivate::setupScriptSupport: setting up script support, package is in "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-wicd/" which is a "Plasmoid" package , main script is "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-wicd/contents/code/main.py"
plasmoidviewer(4245)/libplasma Plasma::Package::filePath: "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-wicd/contents/locale" does not exist
plasmoidviewer(4245)/libplasma Plasma::Package::filePath: "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-wicd/contents/config/main.xml" does not exist
plasmoidviewer(4245)/libplasma Plasma::Package::filePath: "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-wicd/contents/ui/config.ui" does not exist
update!
created!
KCrash: Application 'plasmoidviewer' crashing...
sock_file=/home/eon/.kde4/socket-enthalpy/kdeinit4__0
[rraval@enthalpy]$

-- Backtrace:
Application: Plasma Widget Viewer (plasmoidviewer), signal: Segmentation fault
[KCrash Handler]
#6  0xb6e33007 in QFontPrivate::QFontPrivate () from /usr/lib/libQtGui.so.4
#7  0xb6e35a5d in QFont::detach () from /usr/lib/libQtGui.so.4
#8  0xb6e36167 in QFont::resolve () from /usr/lib/libQtGui.so.4
#9  0xb6c96fde in QWidgetPrivate::resolveFont () from /usr/lib/libQtGui.so.4
#10 0xb72a9420 in QGraphicsProxyWidget::event () from /usr/lib/libQtGui.so.4
#11 0xa89b8614 in sipPlasma_Label::event () from /usr/lib/python2.6/site-packages/PyKDE4/plasma.so
#12 0xb6c49994 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#13 0xb6c5107c in QApplication::notify () from /usr/lib/libQtGui.so.4
#14 0xb7d0dfaa in KApplication::notify () from /usr/lib/libkdeui.so.5
#15 0xb75f6fcb in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#16 0xb729cc2e in QGraphicsWidgetPrivate::updateFont () from /usr/lib/libQtGui.so.4
#17 0xb7297402 in QGraphicsWidget::event () from /usr/lib/libQtGui.so.4
#18 0xb72a9324 in QGraphicsProxyWidget::event () from /usr/lib/libQtGui.so.4
#19 0xa89b8614 in sipPlasma_Label::event () from /usr/lib/python2.6/site-packages/PyKDE4/plasma.so
#20 0xb6c49994 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#21 0xb6c5107c in QApplication::notify () from /usr/lib/libQtGui.so.4
#22 0xb7d0dfaa in KApplication::notify () from /usr/lib/libkdeui.so.5
#23 0xb75f6fcb in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#24 0xb7268729 in ?? () from /usr/lib/libQtGui.so.4
#25 0xb727a3de in QGraphicsScene::qt_metacall () from /usr/lib/libQtGui.so.4
#26 0xb79f3ada in Plasma::Corona::qt_metacall () from /usr/lib/libplasma.so.3
#27 0xb760569b in QMetaCallEvent::placeMetaCall () from /usr/lib/libQtCore.so.4
#28 0xb7606d9e in QObject::event () from /usr/lib/libQtCore.so.4
#29 0xb727a6e4 in QGraphicsScene::event () from /usr/lib/libQtGui.so.4
#30 0xb6c49994 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#31 0xb6c5107c in QApplication::notify () from /usr/lib/libQtGui.so.4
#32 0xb7d0dfaa in KApplication::notify () from /usr/lib/libkdeui.so.5
#33 0xb75f6fcb in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#34 0xb75f7bb2 in QCoreApplicationPrivate::sendPostedEvents () from /usr/lib/libQtCore.so.4
#35 0xb75f7d7d in QCoreApplication::sendPostedEvents () from /usr/lib/libQtCore.so.4
#36 0xb7621a9f in ?? () from /usr/lib/libQtCore.so.4
#37 0xb50f1d98 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#38 0xb50f53e0 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#39 0xb50f5513 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#40 0xb76216cc in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#41 0xb6ce76c5 in ?? () from /usr/lib/libQtGui.so.4
#42 0xb75f5579 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#43 0xb75f59ca in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#44 0xb75f7e3f in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#45 0xb6c49817 in QApplication::exec () from /usr/lib/libQtGui.so.4
#46 0x0804f883 in _start ()
Comment 1 Ronuk Raval 2009-08-26 23:46:33 UTC
After some more work, I have located the exact location of the bug: adding a QGraphicsLinearLayout to Plasma::TabBar causes a segfault. Attaching a small test plasmoid to demonstrate this.

[rraval@enthalpy]$ plasmapkg -i plasma-applet-segfault.zip 
Successfully installed /home/eon/Projects/plasma/plasma-applet-segfault.zip
[rraval@enthalpy]$ plasmoidviewer plasma-applet-segfault
plasmoidviewer(2751)/plasma main: setting FormFactor to "planar"
plasmoidviewer(2751)/plasma main: setting Location to "floating"
plasmoidviewer(2751)/plasma main: setting containment to "null"
plasmoidviewer(2751)/plasma FullView::addApplet: adding applet "plasma-applet-segfault" in "null"
plasmoidviewer(2751)/libplasma Plasma::CoronaPrivate::addContainment: loading of containment "null" failed.
plasmoidviewer(2751)/libplasma Plasma::AppletPrivate::init: Check your constructor!  You probably want to be passing in a Service::Ptr  or a QVariantList with a valid storageid as arg[0].
plasmoidviewer(2751)/libplasma Plasma::Applet::load: we have a script using the "python" API
plasmoidviewer(2751)/libplasma Plasma::AppletPrivate::setupScriptSupport: setting up script support, package is in "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-segfault/" which is a "Plasmoid" package , main script is "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-segfault/contents/code/main.py"
plasmoidviewer(2751)/libplasma Plasma::Package::filePath: "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-segfault/contents/locale" does not exist
plasmoidviewer(2751)/libplasma Plasma::Package::filePath: "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-segfault/contents/config/main.xml" does not exist
plasmoidviewer(2751)/libplasma Plasma::Package::filePath: "/home/eon/.kde4/share/apps/plasma/plasmoids/plasma-applet-segfault/contents/ui/config.ui" does not exist
KCrash: Application 'plasmoidviewer' crashing...
sock_file=/home/eon/.kde4/socket-enthalpy/kdeinit4__0

[1]+  Stopped                 plasmoidviewer plasma-applet-segfault
[rraval@enthalpy]$
Comment 2 Ronuk Raval 2009-08-26 23:47:46 UTC
Created attachment 36478 [details]
Small Plasmoid to demonstrate segfault
Comment 3 Ronuk Raval 2009-12-29 23:54:09 UTC
Created attachment 39445 [details]
Plasmoid demonstrating workaround

Apparently this bug gets no love from the powers that be. In any case, I'll document the workaround I've stumbled upon here.

So, plasma segfaults when a QGraphicsLinearLayout is added to a TabBar. However, this crash can be avoided by using a QGraphicsGridLayout to simulate a QGraphicsLinearLayout (i.e. use only one column or row). Adding a QGraphicsGridLayout to a TabBar works as expected.

Attaching a small plasmoid that demonstrates this.
Comment 4 Aaron J. Seigo 2010-05-14 03:24:01 UTC
replicating it line by line using javascript, it does not crash. (ignoring the fact that adding the same label to a tab as well as layout in another tab is a bit odd / nonsensical) .. could be a problem in the python bindings, but it certainly does work within plasma (and in scriptengines such as the js one)