[PyQt] sip.wrapinstance crashes when object address is larger than 32 bits.
Phil Thompson
phil at riverbankcomputing.com
Wed Feb 5 11:05:35 GMT 2014
On 29-01-2014 5:05 pm, Yves Boudreault wrote:
> Hi,
>
> On a Windows 64 bit machine, when
> "long(_OpenMayaUI.MQtUtil.mainWindow())" gets larger than 32 bits
> there is a crash in _sip.wrapinstance.
>
> Sample python code that is crashing:
>
> import sip as _sip
> import PyQt4.QtCore as _QtCore
> import PyQt4.QtGui as _QtGui
> import maya.OpenMayaUI as _OpenMayaUI
>
> mainWindow =
> _sip.wrapinstance(long(_OpenMayaUI.MQtUtil.mainWindow()),
> _QtCore.QObject)
>
> The fix is simple; here is how I got around the issue. I just change
> (
> unsigned long" -> "unsigned long long" and "kO!:wrapinstance" ->
> "KO!:wrapinstance" ) in "siplib.c.in" and recompiled.
>
> /*
> * Wrap an instance.
> */
> static PyObject *wrapInstance(PyObject *self, PyObject *args)
> {
> unsigned long long addr;
> sipWrapperType *wt;
>
> if (PyArg_ParseTuple(args, "KO!:wrapinstance", &addr,
> &sipWrapperType_Type, &wt))
> return sip_api_convert_from_type((void *)addr, wt->type, NULL);
>
> return NULL;
> }
>
> Please let me know if there is another workaround.
>
> Yves
Applied - thanks.
Phil
More information about the PyQt
mailing list