File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515#define GetWindowSpareFlag (win ) (((CWindowPeek)(win))->spareFlag)
1616#define GetWindowFromPort (port ) ((WindowRef)(port))
1717#define GetWindowPortBounds (win , rectp ) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
18+ #define IsPointerValid (p ) (((long)p&3) == 0)
1819#endif
1920#if ACCESSOR_CALLS_ARE_FUNCTIONS
2021/* Classic calls that we emulate in carbon mode */
@@ -3038,7 +3039,7 @@ WinObj_WhichWindow(w)
30383039 Py_INCREF (it );
30393040 } else {
30403041 it = (PyObject * ) GetWRefCon (w );
3041- if (it == NULL || ((WindowObject * )it )-> ob_itself != w || !WinObj_Check (it )) {
3042+ if (it == NULL || ! IsPointerValid (( Ptr ) it ) || ((WindowObject * )it )-> ob_itself != w || !WinObj_Check (it )) {
30423043 it = WinObj_New (w );
30433044 ((WindowObject * )it )-> ob_freeit = NULL ;
30443045 } else {
Original file line number Diff line number Diff line change 6161#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
6262#define GetWindowFromPort(port) ((WindowRef)(port))
6363#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
64+ #define IsPointerValid(p) (((long)p&3) == 0)
6465#endif
6566#if ACCESSOR_CALLS_ARE_FUNCTIONS
6667/* Classic calls that we emulate in carbon mode */
9192 Py_INCREF(it);
9293 } else {
9394 it = (PyObject *) GetWRefCon(w);
94- if (it == NULL || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
95+ if (it == NULL || !IsPointerValid((Ptr)it) || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
9596 it = WinObj_New(w);
9697 ((WindowObject *)it)->ob_freeit = NULL;
9798 } else {
You can’t perform that action at this time.
0 commit comments