[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [plasma] [Bug 320288] New: Using threads in widgets, crashes them intermittently
From:       Silver Moon <m00n.silv3r () gmail ! com>
Date:       2013-05-26 6:35:56
Message-ID: bug-320288-17878 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=320288

            Bug ID: 320288
           Summary: Using threads in widgets, crashes them intermittently
    Classification: Unclassified
           Product: plasma
           Version: 4.9.5
          Platform: Other
               URL: http://pastebin.com/cNk0MG7w
                OS: Linux
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: desktop
          Assignee: plasma-bugs@kde.org
          Reporter: m00n.silv3r@gmail.com

Small and simple widget : http://pastebin.com/cNk0MG7w

Run it using plasmoidviewer and it will crash 50% time and run 50% time.

WHY ?

Reproducible: Sometimes

Steps to Reproduce:
1. Create a new widget
2. Paste the code in it, http://pastebin.com/cNk0MG7w
3. Run it using plasmoidviewer
4. Close and run again, and keep doing that.
Actual Results:  
It crashes 50% of the time and runs 50% of the time

Expected Results:  
The plasmoid should work fine always ?

SOURCE
============

# -*- coding: utf-8 -*-

import threading, thread, time

# KDE and QT libraries
from PyQt4 import QtCore
from PyQt4.QtCore import *
from PyQt4.QtGui import QGraphicsLinearLayout
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript

# Main applet class to create and launch the plasmoid
class analytics_applet(plasmascript.Applet):

    #constructor
    def __init__(self, parent, args=None):
        plasmascript.Applet.__init__(self, parent)

    # the init function is called when creating the applet
    def init(self):
        #self.setHasConfigurationInterface(False)
        self.setAspectRatioMode(Plasma.Square)

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")

        self.layout = QGraphicsLinearLayout(Qt.Vertical, self.applet)

        self.applet.setLayout(self.layout)
        self.resize(300,150)

        # START the worker thread
        self.thread = worker_thread()
        self.thread.start()

class worker_thread(QtCore.QThread):

    def __init__(self):
        QtCore.QThread.__init__(self)

    def run(self):

        while True :
            print 'OK'
            time.sleep( 1 )
        return

# this function is called by the plasma system to create and load the applet
def CreateApplet(parent):
    return analytics_applet(parent)








CRASH TRACE
============
Application: Plasma Widget Viewer (plasmoidviewer), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f2c4d0a1780 (LWP 10327))]

Thread 3 (Thread 0x7f2c33018700 (LWP 10328)):
#0  0x00007f2c4a784313 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f2c43ab1d84 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f2c43ab1ea4 in g_main_context_iteration () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f2c4af04c16 in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007f2c4aed52bf in
QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from
/usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007f2c4aed5548 in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
/usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f2c4add6b10 in QThread::exec() () from
/usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f2c4aeb59af in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007f2c4add9aec in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007f2c43f80e9a in start_thread () from
/lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007f2c4a78fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f2c2a207700 (LWP 10329)):
#0  0x00007f2c4a789033 in select () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f2c31b5ed3d in ?? () from /usr/lib/libpython2.7.so.1.0
#2  0x00007f2c31b34d72 in PyEval_EvalFrameEx () from
/usr/lib/libpython2.7.so.1.0
#3  0x00007f2c31b35c38 in PyEval_EvalCodeEx () from
/usr/lib/libpython2.7.so.1.0
#4  0x00007f2c31b8bc76 in ?? () from /usr/lib/libpython2.7.so.1.0
#5  0x00007f2c31c051be in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#6  0x00007f2c31c694e0 in ?? () from /usr/lib/libpython2.7.so.1.0
#7  0x00007f2c31c051be in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#8  0x00007f2c31c05ac7 in PyEval_CallObjectWithKeywords () from
/usr/lib/libpython2.7.so.1.0
#9  0x00007f2c3125c692 in ?? () from /usr/lib/python2.7/dist-packages/sip.so
#10 0x00007f2c315030f7 in ?? () from
/usr/lib/python2.7/dist-packages/PyQt4/QtCore.so
#11 0x00007f2c31544050 in ?? () from
/usr/lib/python2.7/dist-packages/PyQt4/QtCore.so
#12 0x00007f2c4add9aec in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#13 0x00007f2c43f80e9a in start_thread () from
/lib/x86_64-linux-gnu/libpthread.so.0
#14 0x00007f2c4a78fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#15 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f2c4d0a1780 (LWP 10327)):
[KCrash Handler]
#5  0x00007f2c4a6d2425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007f2c4a6d5b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x00007f2c31bc3f0e in Py_FatalError () from /usr/lib/libpython2.7.so.1.0
#8  0x00007f2c31c55b4b in PyGILState_Release () from
/usr/lib/libpython2.7.so.1.0
#9  0x00007f2c3051ba93 in
sipPlasma_AppletScript::constraintsEvent(QFlags<Plasma::Constraint>) () from
/usr/lib/python2.7/dist-packages/PyKDE4/plasma.so
#10 0x00007f2c4c46c538 in
Plasma::Applet::constraintsEvent(QFlags<Plasma::Constraint>) () from
/usr/lib/libplasma.so.3
#11 0x00007f2c4c47d0c0 in ?? () from /usr/lib/libplasma.so.3
#12 0x00007f2c4c48cd6a in Plasma::Containment::addApplet(Plasma::Applet*,
QPointF const&, bool) () from /usr/lib/libplasma.so.3
#13 0x000000000040a5ee in _start ()

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic