Example code and stack trace at the end of the email.  Steps to reproduce:
pass the path to a video file (one playable by Phonon) as a command line
argument, click the delete button, and then move the window.  I get this on
MacOS 10.7 / Apple Python 2.7 / PySide 1.0.5.  I also got it on MacOS 10.6
and previous versions of Python and PySide.  I do not seem able to reproduce
under Linux, though.  It seems to have something to do with the interaction
of tracking the Phonon objects in an array and also deleting them.  This is
just stripped down example code to make the problem as simple as possible,
but my goal is to be able to track several Phonon VideoWidgets in an array,
and also be able to delete them (both remove them from the array and delete
the VideoWidgets and their associated MediaObjects, to free up their
memory).  Any help appreciated.  Thanks,

Code:

#!/usr/bin/env python

import sys
from PySide.QtGui import QApplication, QWidget, QPushButton, QGridLayout
from PySide.phonon import Phonon

def video(file):
  global vwidgets
  global mobjects
  media_source = Phonon.MediaSource(file)
  media_object = Phonon.MediaObject()
  media_object.setCurrentSource(
media_source)
  video_widget = Phonon.VideoWidget()
  Phonon.createPath(media_object, video_widget)
  media_object.play()
  vwidgets.append(video_widget)
  mobjects.append(media_object)

def delvideo():
  global vwidgets
  global mobjects
  vw = vwidgets[0]
  mo = mobjects[0]
  vwidgets.remove(vw)
  mobjects.remove(mo)
  mo.deleteLater()
  vw.deleteLater()

vwidgets = []
mobjects = []

app = QApplication([])
app.setApplicationName('test')

video(sys.argv[1])

button1 = QPushButton('delete')
button1.clicked.connect(delvideo)

layout = QGridLayout()
layout.addWidget(vwidgets[0], 0, 0)
layout.addWidget(button1, 0, 1)

window = QWidget()
window.setLayout(layout)
window.show()

app.exec_()

Stack:

Application Specific Information:
objc_msgSend() selector name: _windowFrameDidChange:
objc[32009]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                   0x00007fff8f8d9e90 objc_msgSend + 16
1   com.apple.Foundation              0x00007fff8b442716
__-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 +
47
2   com.apple.CoreFoundation          0x00007fff8df1d51a
_CFXNotificationPost + 2634
3   com.apple.Foundation              0x00007fff8b42e9cb
-[NSNotificationCenter postNotificationName:object:userInfo:] + 65
4   com.apple.AppKit                  0x00007fff8ead941f -[NSWindow
_windowMovedToRect:] + 247
5   com.apple.AppKit                  0x00007fff8ead9311 -[NSWindow
_windowMoved:] + 158
6   com.apple.AppKit                  0x00007fff8ea0aad2 -[NSWindow
sendEvent:] + 7404
7   QtGui                             0x000000010c266251 -[QCocoaWindow
sendEvent:] + 241
8   com.apple.AppKit                  0x00007fff8e9a2ae8 -[NSApplication
sendEvent:] + 4592
9   QtGui                             0x000000010c26992a -[QNSApplication
sendEvent:] + 74
10  com.apple.AppKit                  0x00007fff8e93942b -[NSApplication
run] + 548
11  QtGui                             0x000000010c273614
QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) +
1588
12  QtCore                            0x000000010afbab34
QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 68
13  QtCore                            0x000000010afbae54
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 180
14  QtCore                            0x000000010afbc47c
QCoreApplication::exec() + 188
15  QtGui.so                          0x000000010b44b552
Sbk_QApplicationFunc_exec_ + 34
16  org.python.python                 0x000000010a841b58 PyEval_EvalFrameEx
+ 13318
17  org.python.python                 0x000000010a844cd8 PyEval_EvalCodeEx +
1996
18  org.python.python                 0x000000010a844d4d PyEval_EvalCode +
54
19  org.python.python                 0x000000010a85c08f 0x10a7ba000 +
663695
20  org.python.python                 0x000000010a85c14f PyRun_FileExFlags +
157
21  org.python.python                 0x000000010a85d2a2
PyRun_SimpleFileExFlags + 392
22  org.python.python                 0x000000010a86d2af Py_Main + 2715
23  org.python.python                 0x000000010a7b1e88 0x10a7b1000 + 3720
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to