fixed refcount leak in CreateNewWindow() and CreateWindowFromResource().

This commit is contained in:
Just van Rossum 2002-06-05 17:41:03 +00:00
parent aee2d5f975
commit 84fca948c8
2 changed files with 9 additions and 2 deletions

View File

@ -3112,7 +3112,7 @@ static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
&outWindow); &outWindow);
if (_err != noErr) return PyMac_Error(_err); if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&", _res = Py_BuildValue("O&",
WinObj_WhichWindow, outWindow); WinObj_New, outWindow);
return _res; return _res;
} }
@ -3132,7 +3132,7 @@ static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
&outWindow); &outWindow);
if (_err != noErr) return PyMac_Error(_err); if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&", _res = Py_BuildValue("O&",
WinObj_WhichWindow, outWindow); WinObj_New, outWindow);
return _res; return _res;
} }

View File

@ -136,6 +136,13 @@ class MyScanner(Scanner):
([("void", "wStorage", "OutMode")], ([("void", "wStorage", "OutMode")],
[("NullStorage", "*", "InMode")]), [("NullStorage", "*", "InMode")]),
# match FindWindowOfClass
([("WindowRef", "outWindow", "OutMode"), ("WindowPartCode", "outWindowPart", "OutMode")],
[("ExistingWindowPtr", "*", "OutMode"), ("WindowPartCode", "outWindowPart", "OutMode")]),
# then match CreateNewWindow and CreateWindowFromResource
([("WindowRef", "outWindow", "OutMode")],
[("WindowRef", "*", "*")]),
([("WindowPtr", "*", "OutMode")], ([("WindowPtr", "*", "OutMode")],
[("ExistingWindowPtr", "*", "*")]), [("ExistingWindowPtr", "*", "*")]),
([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles ([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles