[pywin32-checkins] /hgroot/pywin32/pywin32: Ensure that PyCom_PyObjectFromIUnknown ...
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2012-08-04 21:59:09
|
changeset 2e3f7a91ef48 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=2e3f7a91ef48 summary: Ensure that PyCom_PyObjectFromIUnknown always consumes the COM reference when bAddRef is FALSE diffstat: com/win32com/src/PyComHelpers.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diffs (25 lines): diff -r 8031b6d1b4dd -r 2e3f7a91ef48 com/win32com/src/PyComHelpers.cpp --- a/com/win32com/src/PyComHelpers.cpp Sun Jul 29 00:05:52 2012 -0400 +++ b/com/win32com/src/PyComHelpers.cpp Sat Aug 04 17:56:22 2012 -0400 @@ -122,8 +122,10 @@ // Look up the map, and create the object. PyObject *obiid = PyWinObject_FromIID(riid); - if (!obiid) return NULL; - + if (!obiid){ + POFIU_RELEASE_ON_FAILURE + return NULL; + } PyObject *createType = PyDict_GetItem(g_obPyCom_MapIIDToType, obiid); Py_DECREF(obiid); if (createType==NULL) { @@ -153,7 +155,7 @@ PyCom_LogF("Object %s created at 0x%0xld, IUnknown at 0x%0xld", myCreateType->tp_name, ret, ret->m_obj); #endif - if (ret && bAddRef && punk) punk->AddRef(); + if (ret && bAddRef) punk->AddRef(); return ret; } |