Hi,<br><br>The following script segfaults:<br><br>import sys<br>import sip<br>from PyQt4.QtGui import *<br><br>a = QApplication(sys.argv)<br><br># create a menu<br>b = QMenu()<br><br># cast it to a widget<br>c = sip.cast(b, QWidget)<br>
<br># cast the widget, which is really a menu, back to a menu.<br># this line crashes<br>d = sip.cast(c, QMenu)<br><br>Here's the stack trace...<br><br>#0 0x5573cf09 in cast (self=0x0, args=0x83c570c) at siplib.c:907<br>
#1 0x555eccf0 in PyCFunction_Call () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#2 0x5566465a in call_function () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#3 0x55660f83 in PyEval_EvalFrameEx () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
#4 0x55662980 in PyEval_EvalCodeEx () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#5 0x5565b76c in PyEval_EvalCode () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#6 0x5568a3a2 in run_mod () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
#7 0x5568a328 in PyRun_FileExFlags () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#8 0x556562f3 in builtin_execfile () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#9 0x555eccf0 in PyCFunction_Call () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
#10 0x5566465a in call_function () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#11 0x55660f83 in PyEval_EvalFrameEx () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#12 0x55662980 in PyEval_EvalCodeEx () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
#13 0x5565b76c in PyEval_EvalCode () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#14 0x5566620a in exec_statement () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#15 0x5565ed88 in PyEval_EvalFrameEx () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
#16 0x55662980 in PyEval_EvalCodeEx () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#17 0x555d61ca in function_call () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#18 0x555a5810 in PyObject_Call () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
#19 0x555bbeae in instancemethod_call () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#20 0x555a5810 in PyObject_Call () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>#21 0x555a5e03 in PyObject_CallMethodObjArgs () from /usr/apps/python/python-2.6.1/lib/libpython2.6.so.1.0<br>
<br>The following line in siplib.c:907:cast() is crashing:<br><br> if ((addr = sip_api_get_cpp_ptr(sw, type->type)) == NULL)<br> return NULL;<br> <br>Above, "type" (the one left of ->) is NULL.<br>
<br>I'm using sip-4.10, PyQt-x11-gpl-4.7, and Qt 4.5.3.<br><br>Am I using sip.cast incorrectly? Any help would be greatly appreciated.<br><br>Thanks,<br><br>nathan<br>