[PyKDE] a bug in virtual handler?
Fukuda Masaki
fukuda at wni.co.jp
Sun Oct 24 08:57:30 BST 1999
Hello folks,
I'm trying to generate python bindings of my application.
I got a problem in virtual handler that return class-type.
I can not get correct return value in C++ side.
C++ and SIP code:
class RpdSheet : QObject {
public:
RpdSheet(const char* = 0);
virtual RpdRect2D boundingRect();
[...]
};
Generated binding code is:
RpdRect2D sipRpdSheet::sipVH_boundingRect(const sipMethodCache *pymc,sipThisType *sipThis,int sipRelLock)
{
RpdRect2D *res;
PyObject *resobj;
PyObject *sipArgs;
sipArgs = Py_BuildValue("(O)",sipThis -> sipSelf);
if (sipArgs == NULL)
goto reportError;
resobj = PyEval_CallObject(pymc -> pyMethod,sipArgs);
Py_DECREF(sipArgs);
if (resobj != NULL)
{
bool iserr = false;
if (sipCanConvertToCpp(resobj,sipClass_RpdRect2D))
res = (RpdRect2D *)sipConvertToCpp(resobj,sipClass_RpdRect2D,&iserr);
else
iserr = true;
Py_DECREF(resobj); // !!!!!!!! HERE !!!!!!!!
// !!!!! *res is released ???
if (!iserr)
goto releaseLock;
sipBadVirtualResultType(sipName_rapid2_RpdSheet,sipName_qt_boundingRect);
}
reportError:
PyErr_Print();
releaseLock:
sipCondReleaseLock(sipRelLock);
return *res;
}
In sipVH_xxxx() generated by sip-0.9, do Py_DECREF(resobj)
before return. I think, when Py_DECREF do, the memory pointed
by 'res' released, correct?
Does anyone have this solution?
thanks in advanse.
------------------------------------------
Masaki Fukuda <fukuda at wni.co.jp>
(BCDE)Weathernews, Inc.
Phone:043-274-5508, FAX:043-274-4957,4955
More information about the PyQt
mailing list