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

List:       pykde
Subject:    [PyQt] [Bug Report] SIGSEGV in simple application
From:       Marc Van Daele <marc.van.daele90 () gmail ! com>
Date:       2017-04-22 10:57:37
Message-ID: CAPHHUUkVUgmqyAQ9bksU6YFMkWSdpNWfafxwTq9j_JLG3iY0rQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

The following Python (2.7) application results in a SIGSEGV in the last
line.
Unfortunately, I don't understand why.
I guess that the Foo() object is deleted too early, although similar
constructs (in the OK section of the program) work just fine.

from PyQt4 import QtCore
import faulthandler


class Foo(QtCore.QObject):
    sig_value_changed = QtCore.pyqtSignal(object)
    a_list = []

    def bar(self):
        print("bar")


# OK
faulthandler.enable()
Foo().bar()
x = Foo()
x.sig_value_changed.connect(lambda: None)
Foo().a_list.append("x")

# SIGSEGV
Foo().sig_value_changed.connect(lambda: None)


Is this a bug? Or am I missing something?

Thanks in advance,

Marc

[Attachment #5 (text/html)]

<div dir="ltr"><div>Hello,<br></div><div><br></div><div>The following Python (2.7) \
application results in a SIGSEGV in the last line.   </div><div>Unfortunately, I \
don&#39;t understand why.   </div><div>I guess that the Foo() object is deleted too \
early, although similar constructs (in the OK section of the program) work just \
fine.</div><div><br></div><blockquote style="margin:0px 0px 0px \
40px;border:none;padding:0px"><div><pre style="font-family:&quot;dejavu sans \
mono&quot;;font-size:12pt"><pre style="font-family:&quot;dejavu sans \
mono&quot;;font-size:12pt"><span style="color:rgb(0,0,128);font-weight:bold">from \
</span>PyQt4 <span style="color:rgb(0,0,128);font-weight:bold">import \
</span>QtCore<br><span style="color:rgb(0,0,128);font-weight:bold">import \
</span>faulthandler<br><br><br><span \
style="color:rgb(0,0,128);font-weight:bold">class </span>Foo(QtCore.QObject):<br>    \
sig_value_changed = QtCore.pyqtSignal(<span \
style="color:rgb(0,0,128)">object</span>)<br>    a_list = []<br><br>    <span \
style="color:rgb(0,0,128);font-weight:bold">def </span>bar(<span \
style="color:rgb(148,85,141)">self</span>):<br>        <span \
style="color:rgb(0,0,128);font-weight:bold">print</span>(<span \
style="color:rgb(0,128,0);font-weight:bold">&quot;bar&quot;</span>)<br><br><br><span \
style="color:rgb(128,128,128);font-style:italic"># \
OK<br></span>faulthandler.enable()<br>Foo().bar()<br>x = \
Foo()<br>x.sig_value_changed.connect(<span \
style="color:rgb(0,0,128);font-weight:bold">la<wbr>mbda</span>: <span \
style="color:rgb(0,0,128)">None</span>)<br>Foo().a_list.append(<span \
style="color:rgb(0,128,0);font-weight:bold">&quot;x&quot;</span>)<br><br><span \
style="color:rgb(128,128,128);font-style:italic"># \
SIGSEGV<br></span>Foo().sig_value_changed.<wbr>connect(<span \
style="color:rgb(0,0,128);font-weight:bold">lambda</span>: <span \
style="color:rgb(0,0,128)">None</span>)<br></pre></pre></div></blockquote><div><pre \
style="font-family:&quot;dejavu sans mono&quot;;font-size:12pt"><div \
style="font-family:arial,sans-serif;font-size:small;white-space:normal"><br></div><div \
style="font-family:arial,sans-serif;font-size:small;white-space:normal">Is this a \
bug? Or am I missing something?</div><div \
style="font-family:arial,sans-serif;font-size:small;white-space:normal"><br></div><div \
style="font-family:arial,sans-serif;font-size:small;white-space:normal">Thanks in \
advance,</div><div style="font-family:arial,sans-serif;font-size:small;white-space:normal"><br></div><div \
style="font-family:arial,sans-serif;font-size:small;white-space:normal">Marc</div><div><br></div></pre></div></div>



[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

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

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