wx.media.mediactrl always crashes under Lion, Python 2.7.2 Cocoa, wx 2.9.3.1

I’m trying to use the MediaCtrl, but I’m faced with a severe crash every time. The crash doesn’t happen if I create the control, but happens whenever I add the control to a sizer. If I don’t add it to a sizer, it doesn’t show up.

This happens in my code (which is very barebones, I was just testing to see if I could use this control), in the demo’s code, as well as in any example code I copy and paste from online.

If you want example code, you can copy and paste the code from the demo or here, as they both crash for me:

http://stackoverflow.com/questions/7120634/how-to-resize-videos-in-wx-media-mediactrl

The crash allows me to submit a bug report to Apple. That report contains this error every time, with the last call being wxWindow::DoGetSize(). Do you think that this makes it a wxWidgets error? What are my options if I want to use this control?

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)

Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:

–>

__TEXT 0000000100000000-0000000100001000 [ 4K] r-x/rwx SM=COW /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Application Specific Information:

objc[50866]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

0 libwx_osx_cocoau-2.9.3.0.0.dylib 0x00000001014d8b6d wxWindow::DoGetSize(int*, int*) const + 45

1 libwx_osx_cocoau-2.9.3.0.0.dylib 0x00000001016b1e79 wxSizerItem::DoSetWindow(wxWindow*) + 57

2 libwx_osx_cocoau-2.9.3.0.0.dylib 0x00000001016b5588 wxSizerItem::wxSizerItem(wxWindow*, int, int, int, wxObject*) + 184

3 core.so 0x00000001010fffde _wrap_Sizer_Add + 846

4 org.python.python 0x00000001000c1112 PyEval_EvalFrameEx + 22626

5 org.python.python 0x00000001000c2d29 PyEval_EvalCodeEx + 2137

6 org.python.python 0x00000001000c0b6a PyEval_EvalFrameEx + 21178

7 org.python.python 0x00000001000c2d29 PyEval_EvalCodeEx + 2137

8 org.python.python 0x000000010003da80 function_call + 176

9 org.python.python 0x000000010000c5e2 PyObject_Call + 98

10 org.python.python 0x000000010001ebcb instancemethod_call + 363

11 org.python.python 0x000000010000c5e2 PyObject_Call + 98

12 org.python.python 0x0000000100077a68 slot_tp_init + 88

13 org.python.python 0x0000000100074e65 type_call + 245

14 org.python.python 0x000000010000c5e2 PyObject_Call + 98

15 org.python.python 0x00000001000be5f3 PyEval_EvalFrameEx + 11587

16 org.python.python 0x00000001000c2d29 PyEval_EvalCodeEx + 2137

17 org.python.python 0x00000001000c2e46 PyEval_EvalCode + 54

18 org.python.python 0x00000001000e7b6e PyRun_FileExFlags + 174

19 org.python.python 0x00000001000e7e29 PyRun_SimpleFileExFlags + 489

20 org.python.python 0x00000001000fe77c Py_Main + 2940

21 org.python.python 0x0000000100000f14 0x100000000 + 3860

There are currently no mediactrl backends implemented for the Cocoa build of wxWidgets, so the construction of the widget is failing. IIRC it has something to do with the available backends not being 64-bit compatible. So for now if you need mediactrl you should continue to use the Carbon build.

To avoid the crash when the Cocoa build is being used you can do something like this:

             self.mc = wx.media.PreMediaCtrl()
             ok = self.mc.Create(self)
             if not ok:
                 raise NotImplementedError

···

On 6/11/12 10:13 AM, Cameron Leger wrote:

I'm trying to use the MediaCtrl, but I'm faced with a severe crash every
time. The crash doesn't happen if I create the control, but happens
whenever I add the control to a sizer. If I don't add it to a sizer, it
doesn't show up.

This happens in my code (which is very barebones, I was just testing to
see if I could use this control), in the demo's code, as well as in any
example code I copy and paste from online.

If you want example code, you can copy and paste the code from the demo
or here, as they both crash for me:

python - How to resize videos in wx.media.MediaCtrl - Stack Overflow

The crash allows me to submit a bug report to Apple. That report
contains this error every time, with the last call being
wxWindow::DoGetSize(). Do you think that this makes it a wxWidgets
error? What are my options if I want to use this control?

--
Robin Dunn
Software Craftsman

Thank you for your reply. I downloaded the 2.9.3.1 2.7 Carbon Demos and tried to run the MediaCtrl demo, but I got the same crash (but with a KERN_PROTECTION_FAILURE). Looking through the loaded modules, it seemed to still be referencing the installed wxPython version (I’m not sure if the demo comes bundled with a frozen copy of wxPython).

For fear of messing up my current wxPython installation, I’ll stick with the Carbon build and not use the MediaCtrl. Besides, it’s easier to open the file in Quicktime if the user presses the button.

···

On Monday, June 11, 2012 3:12:39 PM UTC-4, Robin Dunn wrote:

On 6/11/12 10:13 AM, Cameron Leger wrote:

I’m trying to use the MediaCtrl, but I’m faced with a severe crash every

time. The crash doesn’t happen if I create the control, but happens

whenever I add the control to a sizer. If I don’t add it to a sizer, it

doesn’t show up.

This happens in my code (which is very barebones, I was just testing to

see if I could use this control), in the demo’s code, as well as in any

example code I copy and paste from online.

If you want example code, you can copy and paste the code from the demo

or here, as they both crash for me:

http://stackoverflow.com/questions/7120634/how-to-resize-videos-in-wx-media-mediactrl

The crash allows me to submit a bug report to Apple. That report

contains this error every time, with the last call being

wxWindow::DoGetSize(). Do you think that this makes it a wxWidgets

error? What are my options if I want to use this control?

There are currently no mediactrl backends implemented for the Cocoa
build of wxWidgets, so the construction of the widget is failing. IIRC
it has something to do with the available backends not being 64-bit
compatible. So for now if you need mediactrl you should continue to use
the Carbon build.

To avoid the crash when the Cocoa build is being used you can do
something like this:

         [self.mc](http://self.mc) = wx.media.PreMediaCtrl()

         ok = self.mc.Create(self)

         if not ok:

             raise NotImplementedError


Robin Dunn

Software Craftsman

http://wxPython.org

It doesn't. It's just a simple app bundle that uses the external Python and its packages to run the demo code.

···

On 6/11/12 1:45 PM, Cameron Leger wrote:

Thank you for your reply. I downloaded the 2.9.3.1 2.7 Carbon Demos and
tried to run the MediaCtrl demo, but I got the same crash (but with a
KERN_PROTECTION_FAILURE). Looking through the loaded modules, it seemed
to still be referencing the installed wxPython version (I'm not sure if
the demo comes bundled with a frozen copy of wxPython).

--
Robin Dunn
Software Craftsman