PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 727 - PySide crashes on OS X
: PySide crashes on OS X
Status: CLOSED DUPLICATE of bug 735
Product: PySide
Classification: Unclassified
Component: QtGui
: 1.0.0
: Macintosh Mac OS
: P2 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-03-12 09:50 EET by Jari Tenhunen
Modified: 2011-04-01 23:16 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jari Tenhunen 2011-03-12 09:50:50 EET
Using PySide binary from [1] and Qt 4.7.1, my own test program [2] always
crashes. The crash can manifest as segmentation fault, bus error or incorrect
checksum for freed object. FWIW, the program works with PyQt bindings.

One example:

$ /usr/bin/python qtupelo.py
...
python(9024,0x7fff70fecca0) malloc: *** error for object 0x103ec4998: incorrect
checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap


[1] http://pyside.markus-ullmann.de/pyside-1.0.0-qt47-py26apple-r1.pkg
[2] https://github.com/jait/tupelo/tree/qt
Comment 1 Jari Tenhunen 2011-03-12 10:16:48 EET
Some backtraces:

$ gdb --args /usr/bin/python qtupelo.py
...
DEBUG: entering draw_cards()
state_changed(): state: ONGOING, mode: RAMI, score: [0, 0], tricks: [0, 0],
dealer: 0, len(table): 3
DEBUG: entering draw_cards()

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff88fed120 in objc_msgSend ()
(gdb) bt
#0  0x00007fff88fed120 in objc_msgSend ()
#1  0x00007fff87646216 in CGSUnionRegionWithRect ()
#2  0x00007fff86707467 in -[NSRegion addRect:] ()
#3  0x00007fff86707231 in -[NSWindow _setNeedsDisplayInRect:] ()
#4  0x00007fff8670c121 in -[NSView(NSInternal)
_setWindowNeedsDisplayInViewsDrawableRect] ()
#5  0x00007fff8674e67b in -[NSView _removeSubview:] ()
#6  0x00007fff8670aec2 in -[NSView _setSuperview:] ()
#7  0x00007fff8674e1ff in -[NSView removeFromSuperview] ()
#8  0x00000001030f2699 in qt_mac_destructView ()
#9  0x00000001030f4d37 in QWidget::destroy ()
#10 0x00000001031aca03 in QWidget::~QWidget ()
#11 0x00000001024bce4b in QLabelWrapper::~QLabelWrapper ()
#12 0x000000010140b73f in QObjectPrivate::deleteChildren ()
#13 0x00000001031ac9e9 in QWidget::~QWidget ()
#14 0x000000010294352b in QWidgetWrapper::~QWidgetWrapper ()
#15 0x0000000101500efe in QObject::event ()
#16 0x00000001031b079e in QWidget::event ()
#17 0x000000010294f29d in Sbk_QWidgetFunc_event ()
#18 0x000000010000aff3 in PyObject_Call ()
#19 0x00000001000849db in PyEval_CallObjectWithKeywords ()
#20 0x000000010001f548 in PyDescr_NewMethod ()
#21 0x000000010000aff3 in PyObject_Call ()
#22 0x000000010008a51a in PyEval_EvalFrameEx ()
#23 0x000000010008acce in PyEval_EvalCodeEx ()
#24 0x000000010002c8e1 in PyClassMethod_New ()
#25 0x000000010000aff3 in PyObject_Call ()
#26 0x000000010001a9df in PyClass_New ()
#27 0x000000010000aff3 in PyObject_Call ()
#28 0x0000000102948fa9 in QWidgetWrapper::event ()
#29 0x000000010315950d in QApplicationPrivate::notify_helper ()
#30 0x000000010315f53d in QApplication::notify ()
#31 0x00000001021961bd in QApplicationWrapper::notify ()
#32 0x000000010140669c in QCoreApplication::notifyInternal ()
#33 0x00000001014f41db in QCoreApplicationPrivate::sendPostedEvents ()
#34 0x00007fff83eb8401 in __CFRunLoopDoSources0 ()
#35 0x00007fff83eb65f9 in __CFRunLoopRun ()
#36 0x00007fff83eb5dbf in CFRunLoopRunSpecific ()
#37 0x00007fff80ab193a in RunCurrentEventLoopInMode ()
#38 0x00007fff80ab169d in ReceiveNextEventCommon ()
#39 0x00007fff80ab15f8 in BlockUntilNextEventMatchingListInMode ()
#40 0x00007fff8672be64 in _DPSNextEvent ()
#41 0x00007fff8672b7a9 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#42 0x00007fff866f148b in -[NSApplication run] ()
#43 0x0000000103114624 in QEventDispatcherMac::processEvents ()
#44 0x00000001014f2b44 in QEventLoop::processEvents ()
#45 0x00000001014f2e64 in QEventLoop::exec ()
#46 0x00000001014f448c in QCoreApplication::exec ()
#47 0x0000000102191114 in Sbk_QApplicationFunc_exec_ ()
#48 0x0000000100088f3f in PyEval_EvalFrameEx ()
#49 0x00000001000892e1 in PyEval_EvalFrameEx ()
#50 0x000000010008acce in PyEval_EvalCodeEx ()
#51 0x000000010008ad61 in PyEval_EvalCode ()
#52 0x00000001000a265a in Py_CompileString ()
#53 0x00000001000a2723 in PyRun_FileExFlags ()
#54 0x00000001000a423d in PyRun_SimpleFileExFlags ()
#55 0x00000001000b0286 in Py_Main ()
#56 0x0000000100000e6c in ?? ()

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00000001030686c7 in QBoxLayout::~QBoxLayout ()
(gdb) bt
#0  0x00000001030686c7 in QBoxLayout::~QBoxLayout ()
#1  0x000000010232a2bb in QHBoxLayoutWrapper::~QHBoxLayoutWrapper ()
#2  0x00000001030ac8ab in QWidget::~QWidget ()
#3  0x000000010284352b in QWidgetWrapper::~QWidgetWrapper ()
#4  0x0000000101500efe in QObject::event ()
#5  0x00000001030b079e in QWidget::event ()
#6  0x000000010284f29d in Sbk_QWidgetFunc_event ()
#7  0x000000010000aff3 in PyObject_Call ()
#8  0x00000001000849db in PyEval_CallObjectWithKeywords ()
#9  0x000000010001f548 in PyDescr_NewMethod ()
#10 0x000000010000aff3 in PyObject_Call ()
#11 0x000000010008a51a in PyEval_EvalFrameEx ()
#12 0x000000010008acce in PyEval_EvalCodeEx ()
#13 0x000000010002c8e1 in PyClassMethod_New ()
#14 0x000000010000aff3 in PyObject_Call ()
#15 0x000000010001a9df in PyClass_New ()
#16 0x000000010000aff3 in PyObject_Call ()
#17 0x0000000102848fa9 in QWidgetWrapper::event ()
#18 0x000000010305950d in QApplicationPrivate::notify_helper ()
#19 0x000000010305f53d in QApplication::notify ()
#20 0x00000001020961bd in QApplicationWrapper::notify ()
#21 0x000000010140669c in QCoreApplication::notifyInternal ()
#22 0x00000001014f41db in QCoreApplicationPrivate::sendPostedEvents ()
#23 0x00007fff83eb8401 in __CFRunLoopDoSources0 ()
#24 0x00007fff83eb65f9 in __CFRunLoopRun ()
#25 0x00007fff83eb5dbf in CFRunLoopRunSpecific ()
#26 0x00007fff80ab193a in RunCurrentEventLoopInMode ()
#27 0x00007fff80ab169d in ReceiveNextEventCommon ()
#28 0x00007fff80ab15f8 in BlockUntilNextEventMatchingListInMode ()
#29 0x00007fff8672be64 in _DPSNextEvent ()
#30 0x00007fff8672b7a9 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#31 0x00007fff866f148b in -[NSApplication run] ()
#32 0x0000000103014624 in QEventDispatcherMac::processEvents ()
#33 0x00000001014f2b44 in QEventLoop::processEvents ()
#34 0x00000001014f2e64 in QEventLoop::exec ()
#35 0x00000001014f448c in QCoreApplication::exec ()
#36 0x0000000102091114 in Sbk_QApplicationFunc_exec_ ()
#37 0x0000000100088f3f in PyEval_EvalFrameEx ()
#38 0x00000001000892e1 in PyEval_EvalFrameEx ()
#39 0x000000010008acce in PyEval_EvalCodeEx ()
#40 0x000000010008ad61 in PyEval_EvalCode ()
#41 0x00000001000a265a in Py_CompileString ()
#42 0x00000001000a2723 in PyRun_FileExFlags ()
#43 0x00000001000a423d in PyRun_SimpleFileExFlags ()
#44 0x00000001000b0286 in Py_Main ()
#45 0x0000000100000e6c in ?? ()
Comment 2 Hugo Parente Lima 2011-03-15 16:37:07 EET
Thanks for reporting, if you could reduce the crash to a small one-file test
case instead of a whole program would be even better and easy for us to track
and fix the issue.
Comment 3 renato filho 2011-03-21 19:39:20 EET
With the current git version you got a exception if you try usage a class
without first call the PySide base constructor, then first I got this error:

raceback (most recent call last):
  File "./qtupelo.py", line 206, in <module>
    main()
  File "./qtupelo.py", line 196, in main
    win = TupeloApp(**opts.__dict__)
  File "./qtupelo.py", line 100, in __init__
    self.create_game(remote, server)
  File "./qtupelo.py", line 109, in create_game
    self.player = GPlayer('Ihiminen')
  File "/home/renato/work/pyside/test/tupelo/tupelo/qcommon.py", line 213, in
__init__
    CliPlayer.__init__(self, name)
  File "/home/renato/work/pyside/test/tupelo/tupelo/players.py", line 93, in
__init__
    threading.Thread.__init__(self, None, None, name)
  File "/usr/lib/python2.7/threading.py", line 446, in __init__
    self.__daemonic = self._set_daemon()
RuntimeError: '__init__' method of object's base class (GPlayer) not called.


Then after fix this with this code:

--- a/tupelo/qcommon.py
+++ b/tupelo/qcommon.py
@@ -210,8 +210,8 @@ class _GPlayerBase(QtCore.QObject):
 class GPlayer(_GPlayerBase, CliPlayer):

     def __init__(self, name):
-        CliPlayer.__init__(self, name)
         _GPlayerBase.__init__(self, CliPlayer)
+        CliPlayer.__init__(self, name)


Now I got this error:

Traceback (most recent call last):
  File "./qtupelo.py", line 206, in <module>
    main()
  File "./qtupelo.py", line 196, in main
    win = TupeloApp(**opts.__dict__)
  File "./qtupelo.py", line 100, in __init__
    self.create_game(remote, server)
  File "./qtupelo.py", line 113, in create_game
    self.player.game_state.stateChanged.connect(self.state_changed)
AttributeError: 'GameState' object has no attribute 'stateChanged

Then I got stuck here.
Could you check this and give me some feedback. Would be nice try this
together, ping me on IRC then I can help you to solve this.
Comment 4 Jari Tenhunen 2011-03-21 21:36:18 EET
(In reply to comment #3)
> With the current git version you got a exception if you try usage a class
> without first call the PySide base constructor, 

Pardon?

> then first I got this error:
> 
> raceback (most recent call last):
>   File "./qtupelo.py", line 206, in <module>
>     main()
>   File "./qtupelo.py", line 196, in main
>     win = TupeloApp(**opts.__dict__)
>   File "./qtupelo.py", line 100, in __init__
>     self.create_game(remote, server)
>   File "./qtupelo.py", line 109, in create_game
>     self.player = GPlayer('Ihiminen')
>   File "/home/renato/work/pyside/test/tupelo/tupelo/qcommon.py", line 213, in
> __init__
>     CliPlayer.__init__(self, name)
>   File "/home/renato/work/pyside/test/tupelo/tupelo/players.py", line 93, in
> __init__
>     threading.Thread.__init__(self, None, None, name)
>   File "/usr/lib/python2.7/threading.py", line 446, in __init__
>     self.__daemonic = self._set_daemon()
> RuntimeError: '__init__' method of object's base class (GPlayer) not called.

I don't understand why you would get this. Works fine for me with Python 2.5
and 2.6.

> Then after fix this with this code:
> 
> --- a/tupelo/qcommon.py
> +++ b/tupelo/qcommon.py
> @@ -210,8 +210,8 @@ class _GPlayerBase(QtCore.QObject):
>  class GPlayer(_GPlayerBase, CliPlayer):
> 
>      def __init__(self, name):
> -        CliPlayer.__init__(self, name)
>          _GPlayerBase.__init__(self, CliPlayer)
> +        CliPlayer.__init__(self, name)
> 
> 
> Now I got this error:
> 
> Traceback (most recent call last):
>   File "./qtupelo.py", line 206, in <module>
>     main()
>   File "./qtupelo.py", line 196, in main
>     win = TupeloApp(**opts.__dict__)
>   File "./qtupelo.py", line 100, in __init__
>     self.create_game(remote, server)
>   File "./qtupelo.py", line 113, in create_game
>     self.player.game_state.stateChanged.connect(self.state_changed)
> AttributeError: 'GameState' object has no attribute 'stateChanged
> 
> Then I got stuck here.

This is because you changed the constructor call order. player.game_state is a
different type object now.

With this dirty hack you can get pass this if it helps in debugging:

jari@macbook:~/projects/tupelo $ git diff
diff --git a/tupelo/qcommon.py b/tupelo/qcommon.py
index 37cf3cc..edcd666 100644
--- a/tupelo/qcommon.py
+++ b/tupelo/qcommon.py
@@ -210,8 +210,9 @@ class _GPlayerBase(QtCore.QObject):
 class GPlayer(_GPlayerBase, CliPlayer):

     def __init__(self, name):
-        CliPlayer.__init__(self, name)
         _GPlayerBase.__init__(self, CliPlayer)
+        CliPlayer.__init__(self, name)
+        self.game_state = GGameState()
Comment 5 renato filho 2011-03-22 16:27:05 EET
After some more deep investigation I found the problem, and that is related
with bug #735.

I will mark this duplicated of bug #735 (The bug 735 was fixed today).

Could try run the program with git HEAD source code? And check if everything is
ok.


Thanks for your help.

*** This bug has been marked as a duplicate of bug 735 ***
Comment 6 Jari Tenhunen 2011-03-22 22:34:49 EET
(In reply to comment #5)
> After some more deep investigation I found the problem, and that is related
> with bug #735.
> 
> I will mark this duplicated of bug #735 (The bug 735 was fixed today).
> 
> Could try run the program with git HEAD source code? And check if everything is
> ok.

That's a bit tricky... Last time I tried to build for OS X I was facing quite a
lot of problems. Unless somebody can provide a OS X build, I will have to trust
you or verify when you have an official release with the fix and OS X binaries.
Comment 7 Hugo Parente Lima 2011-04-01 23:16:04 EEST
Closing bug after release of PySide 1.0.1.