[PyQt] sip.wrapinstance crashes when object address is larger than 32 bits.
Yves Boudreault
Yves.Boudreault at autodesk.com
Wed Jan 29 17:05:56 GMT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140129/f005e554/attachment.html>
More information about the PyQt
mailing list