Update of /cvsroot/pywin32/pywin32/Pythonwin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26302
Modified Files:
Tag: py3k
win32ctrlList.cpp win32ctrlTree.cpp win32notify.cpp win32ui.h
win32util.cpp
Log Message:
Free string members of LV_ITEM and TV_ITEM
Standardize names of conversion functions
Index: win32ui.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ui.h,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** win32ui.h 29 Aug 2008 05:53:29 -0000 1.7.2.1
--- win32ui.h 2 Sep 2008 02:14:43 -0000 1.7.2.2
***************
*** 353,364 ****
PYW_EXPORT PyObject *MakeParaFormatTuple(PARAFORMAT *pFmt);
! PYW_EXPORT PyObject *MakeLV_ITEMTuple(LV_ITEM *item);
! PYW_EXPORT BOOL ParseLV_ITEMTuple( PyObject *args, LV_ITEM *pItem);
PYW_EXPORT PyObject *MakeLV_COLUMNTuple(LV_COLUMN *item);
PYW_EXPORT BOOL ParseLV_COLUMNTuple( PyObject *args, LV_COLUMN *pItem);
! PYW_EXPORT BOOL ParseTV_ITEMTuple( PyObject *args, TV_ITEM *pItem);
! PYW_EXPORT PyObject *MakeTV_ITEMTuple(TV_ITEM *item);
PyObject *PyWin_GetPythonObjectFromLong(LONG_PTR val);
--- 353,366 ----
PYW_EXPORT PyObject *MakeParaFormatTuple(PARAFORMAT *pFmt);
! PYW_EXPORT PyObject *PyWinObject_FromLV_ITEM(LV_ITEM *pItem);
! PYW_EXPORT BOOL PyWinObject_AsLV_ITEM( PyObject *args, LV_ITEM *pItem);
! PYW_EXPORT void PyWinObject_FreeLV_ITEM(LV_ITEM *pItem);
PYW_EXPORT PyObject *MakeLV_COLUMNTuple(LV_COLUMN *item);
PYW_EXPORT BOOL ParseLV_COLUMNTuple( PyObject *args, LV_COLUMN *pItem);
! PYW_EXPORT BOOL PyWinObject_AsTV_ITEM( PyObject *args, TV_ITEM *pItem);
! PYW_EXPORT PyObject *PyWinObject_FromTV_ITEM(TV_ITEM *pItem);
! PYW_EXPORT void PyWinObject_FreeTV_ITEM(TV_ITEM *pItem);
PyObject *PyWin_GetPythonObjectFromLong(LONG_PTR val);
Index: win32util.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32util.cpp,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -C2 -d -r1.13.2.1 -r1.13.2.2
*** win32util.cpp 29 Aug 2008 05:53:30 -0000 1.13.2.1
--- win32util.cpp 2 Sep 2008 02:14:43 -0000 1.13.2.2
***************
*** 315,320 ****
//
//
! // LV_ITEM
! PyObject *MakeLV_ITEMTuple(LV_ITEM *item)
{
PyObject *ret = PyTuple_New(7);
--- 315,320 ----
//
//
! // LV_ITEM
! PyObject *PyWinObject_FromLV_ITEM(LV_ITEM *item)
{
PyObject *ret = PyTuple_New(7);
***************
*** 353,356 ****
--- 353,361 ----
}
+ void PyWinObject_FreeLV_ITEM(LV_ITEM *pItem){
+ if (pItem->mask & LVIF_TEXT)
+ PyWinObject_FreeTCHAR(pItem->pszText);
+ }
+
// @object LV_ITEM|Describes an LV_ITEM tuple, used by the <o PyCListCtrl> object.
// @tupleitem 0|int|item|The item number.
***************
*** 364,371 ****
// <nl>When passed from Python, the tuple must be at least 2 items long, and any item may be None.
// <nl>userob is any Python object at all, but no reference count is kept, so you must ensure the object remains referenced throught the lists life.
! BOOL ParseLV_ITEMTuple( PyObject *args, LV_ITEM *pItem)
{
! PyObject *ob;
! pItem->mask = 0;
Py_ssize_t len = PyTuple_Size(args);
if (len<2 || len > 7) {
--- 369,376 ----
// <nl>When passed from Python, the tuple must be at least 2 items long, and any item may be None.
// <nl>userob is any Python object at all, but no reference count is kept, so you must ensure the object remains referenced throught the lists life.
! BOOL PyWinObject_AsLV_ITEM( PyObject *args, LV_ITEM *pItem)
{
! ZeroMemory(pItem, sizeof(*pItem));
! PyObject *ob, *ob2;
Py_ssize_t len = PyTuple_Size(args);
if (len<2 || len > 7) {
***************
*** 373,426 ****
return FALSE;
}
! // ??? This is questionable, shouldn't be any exceptions left hanging, and if this is called
! // from someplace where an exception legitimately exists, should fetch/restore the exception. ???
! assert (!PyErr_Occurred()); // PyErr_Clear(); // clear any errors, so I can detect my own.
// 0 - iItem.
! if ((ob=PyTuple_GetItem(args, 0))==NULL)
return FALSE;
! pItem->iItem = (UINT)PyInt_AsLong(ob);
! if (PyErr_Occurred()) return FALSE;
// 1 - iSubItem
! if ((ob=PyTuple_GetItem(args, 1))==NULL)
return FALSE;
! pItem->iSubItem = (UINT)PyInt_AsLong(ob);
! if (PyErr_Occurred()) return FALSE;
! // 1/2 - state/stateMask
! if (len<4) return TRUE;
! if ((ob=PyTuple_GetItem(args, 2))==NULL)
return FALSE;
! if (ob != Py_None) {
! pItem->state = (UINT)PyInt_AsLong(ob);
! if (PyErr_Occurred() || (ob=PyTuple_GetItem(args, 3))==NULL)
return FALSE;
- pItem->stateMask = (UINT)PyInt_AsLong(ob);
- if (PyErr_Occurred()) return FALSE;
pItem->mask |= LVIF_STATE;
}
if (len<5) return TRUE;
ob=PyTuple_GET_ITEM(args, 4);
if (!PyWinObject_AsTCHAR(ob, &pItem->pszText, TRUE, (DWORD *)&pItem->cchTextMax))
return FALSE;
- // ??? Need to free this somewhere ???
if (pItem->pszText)
pItem->mask |= LVIF_TEXT;
if (len<6) return TRUE;
! if ((ob=PyTuple_GetItem(args, 5))==NULL)
! return FALSE;
if (ob != Py_None) {
- pItem->mask |= LVIF_IMAGE;
pItem->iImage = PyInt_AsLong(ob);
! if (PyErr_Occurred())
return FALSE;
! }
if (len<7) return TRUE;
! if ((ob=PyTuple_GetItem(args, 6))==NULL)
return FALSE;
! if (ob != Py_None) {
pItem->mask |= LVIF_PARAM;
! pItem->lParam = PyInt_AsLong(ob);
! }
return TRUE;
}
--- 378,446 ----
return FALSE;
}
!
// 0 - iItem.
! ob=PyTuple_GET_ITEM(args, 0);
! pItem->iItem = PyInt_AsLong(ob);
! if (pItem->iImage == -1 && PyErr_Occurred())
return FALSE;
!
// 1 - iSubItem
! ob=PyTuple_GET_ITEM(args, 1);
! pItem->iSubItem = PyInt_AsLong(ob);
! if (pItem->iSubItem == -1 && PyErr_Occurred())
return FALSE;
!
! // 2/3 - state/stateMask
! if (len<3) return TRUE;
! if (len<4){
! PyErr_SetString(PyExc_TypeError, "LV_ITEM: Statemask must be provided if state if provided");
return FALSE;
! }
! ob=PyTuple_GET_ITEM(args, 2);
! ob2=PyTuple_GET_ITEM(args, 3);
! if (ob==Py_None && ob2==Py_None)
! ;
! else if (ob==Py_None || ob2==Py_None) {
! PyErr_SetString(PyExc_TypeError, "LV_ITEM - state and stateMask must both be None, or both not None");
! return FALSE;
! } else {
! pItem->state = PyInt_AsLong(ob);
! if (pItem->state == -1 && PyErr_Occurred())
! return FALSE;
! pItem->stateMask = PyInt_AsLong(ob2);
! if (pItem->stateMask == -1 && PyErr_Occurred())
return FALSE;
pItem->mask |= LVIF_STATE;
}
+ // 4 - text
if (len<5) return TRUE;
ob=PyTuple_GET_ITEM(args, 4);
if (!PyWinObject_AsTCHAR(ob, &pItem->pszText, TRUE, (DWORD *)&pItem->cchTextMax))
return FALSE;
if (pItem->pszText)
pItem->mask |= LVIF_TEXT;
+ // 5 - image index
if (len<6) return TRUE;
! ob=PyTuple_GET_ITEM(args, 5);
if (ob != Py_None) {
pItem->iImage = PyInt_AsLong(ob);
! if (pItem->iImage == -1 && PyErr_Occurred()){
! PyWinObject_FreeLV_ITEM(pItem);
return FALSE;
! }
! pItem->mask |= LVIF_IMAGE;
! }
!
if (len<7) return TRUE;
! ob=PyTuple_GET_ITEM(args, 6);
! if (!PyWinObject_AsPARAM(ob, &pItem->lParam)){
! PyWinObject_FreeLV_ITEM(pItem);
return FALSE;
! }
! if (pItem->lParam)
pItem->mask |= LVIF_PARAM;
!
return TRUE;
}
***************
*** 523,527 ****
//
// TV_ITEM
! PyObject *MakeTV_ITEMTuple(TV_ITEM *item)
{
PyObject *ret = PyTuple_New(8);
--- 543,547 ----
//
// TV_ITEM
! PyObject *PyWinObject_FromTV_ITEM(TV_ITEM *item)
{
PyObject *ret = PyTuple_New(8);
***************
*** 576,588 ****
}
// @object TV_ITEM|Describes a TV_ITEM tuple, used by the <o PyCListCtrl> object.
// A tuple of 8 items:
// <nl>When returned from a win32ui function, will always be a tuple of size 8, and items may be None if not available.
// <nl>When passed to a win32ui function, the tuple may be any length up to 8, and any item may be None.
! BOOL ParseTV_ITEMTuple( PyObject *args, TV_ITEM *pItem)
{
PyObject *ob;
PyObject *ob2;
- pItem->mask = 0;
Py_ssize_t len = PyTuple_Size(args);
if (len > 8) {
--- 596,613 ----
}
+ void PyWinObject_FreeTV_ITEM(TV_ITEM *pItem){
+ if (pItem->mask & TVIF_TEXT)
+ PyWinObject_FreeTCHAR(pItem->pszText);
+ }
+
// @object TV_ITEM|Describes a TV_ITEM tuple, used by the <o PyCListCtrl> object.
// A tuple of 8 items:
// <nl>When returned from a win32ui function, will always be a tuple of size 8, and items may be None if not available.
// <nl>When passed to a win32ui function, the tuple may be any length up to 8, and any item may be None.
! BOOL PyWinObject_AsTV_ITEM( PyObject *args, TV_ITEM *pItem)
{
+ ZeroMemory(pItem, sizeof(*pItem));
PyObject *ob;
PyObject *ob2;
Py_ssize_t len = PyTuple_Size(args);
if (len > 8) {
***************
*** 590,598 ****
return FALSE;
}
- assert (!PyErr_Occurred()); // PyErr_Clear(); // clear any errors, so I can detect my own.
// 0 - hItem
if (len<1) return TRUE;
! if ((ob=PyTuple_GetItem(args, 0))==NULL)
! return FALSE;
if (ob != Py_None) {
// @tupleitem 0|int|hItem|Item handle
--- 615,621 ----
return FALSE;
}
// 0 - hItem
if (len<1) return TRUE;
! ob=PyTuple_GET_ITEM(args, 0);
if (ob != Py_None) {
// @tupleitem 0|int|hItem|Item handle
***************
*** 601,604 ****
--- 624,628 ----
pItem->mask |= TVIF_HANDLE;
}
+
// 1,2 - state/stateMask
if (len<2) return TRUE;
***************
*** 607,614 ****
return FALSE;
}
! if ((ob=PyTuple_GetItem(args, 1))==NULL)
! return FALSE;
! if ((ob2=PyTuple_GetItem(args, 2))==NULL)
! return FALSE;
if (ob==Py_None && ob2==Py_None)
;
--- 631,636 ----
return FALSE;
}
! ob=PyTuple_GET_ITEM(args, 1);
! ob2=PyTuple_GET_ITEM(args, 2);
if (ob==Py_None && ob2==Py_None)
;
***************
*** 619,625 ****
// @tupleitem 1|int|state|Item state. If specified, the stateMask must also be specified.
// @tupleitem 2|int|stateMask|Item state mask
! pItem->state = (int)PyInt_AsLong(ob);
! pItem->stateMask = (int)PyInt_AsLong(ob2);
! if (PyErr_Occurred()) return FALSE;
pItem->mask |= TVIF_STATE;
}
--- 641,650 ----
// @tupleitem 1|int|state|Item state. If specified, the stateMask must also be specified.
// @tupleitem 2|int|stateMask|Item state mask
! pItem->state = PyInt_AsLong(ob);
! if (pItem->state == -1 && PyErr_Occurred())
! return FALSE;
! pItem->stateMask = PyInt_AsLong(ob2);
! if (pItem->stateMask == -1 && PyErr_Occurred())
! return FALSE;
pItem->mask |= TVIF_STATE;
}
***************
*** 630,635 ****
// @tupleitem 3|string|text|Item text
if (!PyWinObject_AsTCHAR(ob, &pItem->pszText, TRUE, (DWORD *)&pItem->cchTextMax))
! return FALSE;
! // ??? This need to be freed after use ???
if (pItem->pszText)
pItem->mask |= TVIF_TEXT;
--- 655,659 ----
// @tupleitem 3|string|text|Item text
if (!PyWinObject_AsTCHAR(ob, &pItem->pszText, TRUE, (DWORD *)&pItem->cchTextMax))
! return FALSE; // last exit without cleanup
if (pItem->pszText)
pItem->mask |= TVIF_TEXT;
***************
*** 637,676 ****
// 4 - image
if (len<5) return TRUE;
! if ((ob=PyTuple_GetItem(args, 4))==NULL)
! return FALSE;
if (ob != Py_None) {
pItem->mask |= TVIF_IMAGE;
! // @tupleitem 4|int|iImage|Offset of items image.
! pItem->iImage = (int)PyInt_AsLong(ob);
! }
// 5 - imageSelected
if (len<6) return TRUE;
! if ((ob=PyTuple_GetItem(args, 5))==NULL)
! return FALSE;
if (ob != Py_None) {
// @tupleitem 5|int|iSelectedImage|Offset of items selected image.
pItem->mask |= TVIF_SELECTEDIMAGE;
! pItem->iSelectedImage = (int)PyInt_AsLong(ob);
! }
// 6 - cChildren
if (len<7) return TRUE;
! if ((ob=PyTuple_GetItem(args, 6))==NULL)
! return FALSE;
if (ob != Py_None) {
// @tupleitem 6|int|cChildren|Number of child items.
- pItem->mask |= TVIF_CHILDREN;
pItem->cChildren = PyInt_AsLong(ob);
! }
// 7 - object
if (len<8) return TRUE;
! if ((ob=PyTuple_GetItem(args, 7))==NULL)
! return FALSE;
if (ob != Py_None) {
// @tupleitem 7|int|lParam|User defined integer param.
! pItem->mask |= LVIF_PARAM;
! if (!PyWinObject_AsPARAM(ob, &pItem->lParam))
return FALSE;
! }
! return !PyErr_Occurred();
}
--- 661,714 ----
// 4 - image
if (len<5) return TRUE;
! ob=PyTuple_GET_ITEM(args, 4);
if (ob != Py_None) {
+ // @tupleitem 4|int|iImage|Image list index of icon for non-seleted state.
+ pItem->iImage = PyInt_AsLong(ob);
+ if (pItem->iImage == -1 && PyErr_Occurred()){
+ PyWinObject_FreeTV_ITEM(pItem);
+ return FALSE;
+ }
pItem->mask |= TVIF_IMAGE;
! }
!
// 5 - imageSelected
if (len<6) return TRUE;
! ob=PyTuple_GET_ITEM(args, 5);
if (ob != Py_None) {
// @tupleitem 5|int|iSelectedImage|Offset of items selected image.
+ pItem->iSelectedImage = PyInt_AsLong(ob);
+ if (pItem->iSelectedImage == -1 && PyErr_Occurred()){
+ PyWinObject_FreeTV_ITEM(pItem);
+ return FALSE;
+ }
pItem->mask |= TVIF_SELECTEDIMAGE;
! }
!
// 6 - cChildren
if (len<7) return TRUE;
! ob=PyTuple_GET_ITEM(args, 6);
if (ob != Py_None) {
// @tupleitem 6|int|cChildren|Number of child items.
pItem->cChildren = PyInt_AsLong(ob);
! if (pItem->cChildren == -1 && PyErr_Occurred()){
! PyWinObject_FreeTV_ITEM(pItem);
! return FALSE;
! }
! pItem->mask |= TVIF_CHILDREN;
! }
!
// 7 - object
if (len<8) return TRUE;
! ob=PyTuple_GET_ITEM(args, 7);
if (ob != Py_None) {
// @tupleitem 7|int|lParam|User defined integer param.
! if (!PyWinObject_AsPARAM(ob, &pItem->lParam)){
! PyWinObject_FreeTV_ITEM(pItem);
return FALSE;
! }
! pItem->mask |= LVIF_PARAM;
! }
!
! return TRUE;
}
***************
*** 1064,1069 ****
}
! // utility to get a nice printable string from any object.
! // reference neutral. NOT !!!!!!!! - Also needs adjustment for Py3k unicode repr
CString GetReprText( PyObject *objectUse )
{
--- 1102,1106 ----
}
! // utility to get a nice printable string from any object. (reference neutral)
CString GetReprText( PyObject *objectUse )
{
Index: win32notify.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32notify.cpp,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** win32notify.cpp 29 Aug 2008 05:53:29 -0000 1.7.2.1
--- win32notify.cpp 2 Sep 2008 02:14:43 -0000 1.7.2.2
***************
*** 87,91 ****
case 'T': {// TV_ITEM structure
TV_ITEM *ptv = (TV_ITEM *)pUse;
! ob = bIgnore ? NULL : MakeTV_ITEMTuple(ptv);
pUse += (sizeof(TV_ITEM));
break;
--- 87,91 ----
case 'T': {// TV_ITEM structure
TV_ITEM *ptv = (TV_ITEM *)pUse;
! ob = bIgnore ? NULL : PyWinObject_FromTV_ITEM(ptv);
pUse += (sizeof(TV_ITEM));
break;
***************
*** 93,97 ****
case 'L': {// LV_ITEM structure
LV_ITEM *plv = (LV_ITEM *)pUse;
! ob = bIgnore ? NULL : MakeLV_ITEMTuple(plv);
pUse += (sizeof(LV_ITEM));
break;
--- 93,97 ----
case 'L': {// LV_ITEM structure
LV_ITEM *plv = (LV_ITEM *)pUse;
! ob = bIgnore ? NULL : PyWinObject_FromLV_ITEM(plv);
pUse += (sizeof(LV_ITEM));
break;
***************
*** 312,317 ****
ob2=Py_BuildValue("iNN(ll)",
nmtv->action,
! MakeTV_ITEMTuple(&nmtv->itemOld),
! MakeTV_ITEMTuple(&nmtv->itemNew),
nmtv->ptDrag.x, nmtv->ptDrag.y);
}
--- 312,317 ----
ob2=Py_BuildValue("iNN(ll)",
nmtv->action,
! PyWinObject_FromTV_ITEM(&nmtv->itemOld),
! PyWinObject_FromTV_ITEM(&nmtv->itemNew),
nmtv->ptDrag.x, nmtv->ptDrag.y);
}
Index: win32ctrlList.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlList.cpp,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** win32ctrlList.cpp 29 Aug 2008 05:53:29 -0000 1.3.2.1
--- win32ctrlList.cpp 2 Sep 2008 02:14:43 -0000 1.3.2.2
***************
*** 301,309 ****
&obLVItem)) { // @pyparm <om PyCListCtrl.LV_ITEM tuple>|item||A tuple describing the new item.
LV_ITEM lvItem;
! if (!ParseLV_ITEMTuple(obLVItem, &lvItem))
return NULL;
GUI_BGN_SAVE;
ret = pList->InsertItem(&lvItem);
GUI_END_SAVE;
} else {
PyErr_Clear();
--- 301,310 ----
&obLVItem)) { // @pyparm <om PyCListCtrl.LV_ITEM tuple>|item||A tuple describing the new item.
LV_ITEM lvItem;
! if (!PyWinObject_AsLV_ITEM(obLVItem, &lvItem))
return NULL;
GUI_BGN_SAVE;
ret = pList->InsertItem(&lvItem);
GUI_END_SAVE;
+ PyWinObject_FreeLV_ITEM(&lvItem);
} else {
PyErr_Clear();
***************
*** 329,337 ****
return NULL;
LV_ITEM lvItem;
! if (!ParseLV_ITEMTuple(obLVItem, &lvItem))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pList->SetItem(&lvItem);
GUI_END_SAVE;
if (!ok)
RETURN_ERR("SetItem failed");
--- 330,339 ----
return NULL;
LV_ITEM lvItem;
! if (!PyWinObject_AsLV_ITEM(obLVItem, &lvItem))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pList->SetItem(&lvItem);
GUI_END_SAVE;
+ PyWinObject_FreeLV_ITEM(&lvItem);
if (!ok)
RETURN_ERR("SetItem failed");
***************
*** 476,480 ****
if (!ok)
RETURN_ERR("GetItem failed");
! return MakeLV_ITEMTuple(&lvItem);
}
--- 478,482 ----
if (!ok)
RETURN_ERR("GetItem failed");
! return PyWinObject_FromLV_ITEM(&lvItem);
}
Index: win32ctrlTree.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlTree.cpp,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -d -r1.6.2.1 -r1.6.2.2
*** win32ctrlTree.cpp 29 Aug 2008 05:53:29 -0000 1.6.2.1
--- win32ctrlTree.cpp 2 Sep 2008 02:14:43 -0000 1.6.2.2
***************
*** 483,491 ****
PyWinObject_AsHANDLE, &tvItem.hInsertAfter, // @pyparm HTREEITEM|hInsertAfter||The item to insert after. Can be an item or TVI_FIRST, TVI_LAST or TVI_SORT
&obTVItem)) { // @pyparm <om PyCTreeCtrl.TV_ITEM tuple>|item||A tuple describing the new item.
! if (!ParseTV_ITEMTuple(obTVItem, &tvItem.item))
return NULL;
GUI_BGN_SAVE;
ret = pList->InsertItem(&tvItem);
GUI_END_SAVE;
goto done;
}
--- 483,492 ----
PyWinObject_AsHANDLE, &tvItem.hInsertAfter, // @pyparm HTREEITEM|hInsertAfter||The item to insert after. Can be an item or TVI_FIRST, TVI_LAST or TVI_SORT
&obTVItem)) { // @pyparm <om PyCTreeCtrl.TV_ITEM tuple>|item||A tuple describing the new item.
! if (!PyWinObject_AsTV_ITEM(obTVItem, &tvItem.item))
return NULL;
GUI_BGN_SAVE;
ret = pList->InsertItem(&tvItem);
GUI_END_SAVE;
+ PyWinObject_FreeTV_ITEM(&tvItem.item);
goto done;
}
***************
*** 513,521 ****
return NULL;
TV_ITEM tvItem;
! if (!ParseTV_ITEMTuple(obTVItem, &tvItem))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pList->SetItem(&tvItem);
GUI_END_SAVE;
if (!ok)
RETURN_ERR("SetItem failed");
--- 514,523 ----
return NULL;
TV_ITEM tvItem;
! if (!PyWinObject_AsTV_ITEM(obTVItem, &tvItem))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pList->SetItem(&tvItem);
GUI_END_SAVE;
+ PyWinObject_FreeTV_ITEM(&tvItem);
if (!ok)
RETURN_ERR("SetItem failed");
***************
*** 569,573 ****
if (!ok)
RETURN_ERR("GetItem failed");
! return MakeTV_ITEMTuple(&tvItem);
}
--- 571,575 ----
if (!ok)
RETURN_ERR("GetItem failed");
! return PyWinObject_FromTV_ITEM(&tvItem);
}
|