Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84fca94

Browse files
committed
fixed refcount leak in CreateNewWindow() and CreateWindowFromResource().
1 parent aee2d5f commit 84fca94

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Mac/Modules/win/_Winmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
31123112
&outWindow);
31133113
if (_err != noErr) return PyMac_Error(_err);
31143114
_res = Py_BuildValue("O&",
3115-
WinObj_WhichWindow, outWindow);
3115+
WinObj_New, outWindow);
31163116
return _res;
31173117
}
31183118

@@ -3132,7 +3132,7 @@ static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
31323132
&outWindow);
31333133
if (_err != noErr) return PyMac_Error(_err);
31343134
_res = Py_BuildValue("O&",
3135-
WinObj_WhichWindow, outWindow);
3135+
WinObj_New, outWindow);
31363136
return _res;
31373137
}
31383138

Mac/Modules/win/winscan.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ def makerepairinstructions(self):
136136
([("void", "wStorage", "OutMode")],
137137
[("NullStorage", "*", "InMode")]),
138138

139+
# match FindWindowOfClass
140+
([("WindowRef", "outWindow", "OutMode"), ("WindowPartCode", "outWindowPart", "OutMode")],
141+
[("ExistingWindowPtr", "*", "OutMode"), ("WindowPartCode", "outWindowPart", "OutMode")]),
142+
# then match CreateNewWindow and CreateWindowFromResource
143+
([("WindowRef", "outWindow", "OutMode")],
144+
[("WindowRef", "*", "*")]),
145+
139146
([("WindowPtr", "*", "OutMode")],
140147
[("ExistingWindowPtr", "*", "*")]),
141148
([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles

0 commit comments

Comments
 (0)