@@ -92,23 +92,10 @@ CtlObj_Convert(v, p_itself)
9292static void CtlObj_dealloc (self )
9393 ControlObject * self ;
9494{
95- SetCRefCon (self -> ob_itself , (long )0 ); /* Make it forget about us */
95+ if ( self -> ob_itself ) SetCRefCon (self -> ob_itself , (long )0 ); /* Make it forget about us */
9696 PyMem_DEL (self );
9797}
9898
99- static PyObject * CtlObj_DisposeControl (_self , _args )
100- ControlObject * _self ;
101- PyObject * _args ;
102- {
103- PyObject * _res = NULL ;
104- if (!PyArg_ParseTuple (_args , "" ))
105- return NULL ;
106- DisposeControl (_self -> ob_itself );
107- Py_INCREF (Py_None );
108- _res = Py_None ;
109- return _res ;
110- }
111-
11299static PyObject * CtlObj_ShowControl (_self , _args )
113100 ControlObject * _self ;
114101 PyObject * _args ;
@@ -452,9 +439,26 @@ static PyObject *CtlObj_as_Resource(_self, _args)
452439
453440}
454441
442+ static PyObject * CtlObj_DisposeControl (_self , _args )
443+ ControlObject * _self ;
444+ PyObject * _args ;
445+ {
446+ PyObject * _res = NULL ;
447+
448+ if (!PyArg_ParseTuple (_args , "" ))
449+ return NULL ;
450+ if ( _self -> ob_itself ) {
451+ SetCRefCon (_self -> ob_itself , (long )0 ); /* Make it forget about us */
452+ DisposeControl (_self -> ob_itself );
453+ _self -> ob_itself = NULL ;
454+ }
455+ Py_INCREF (Py_None );
456+ _res = Py_None ;
457+ return _res ;
458+
459+ }
460+
455461static PyMethodDef CtlObj_methods [] = {
456- {"DisposeControl" , (PyCFunction )CtlObj_DisposeControl , 1 ,
457- "() -> None" },
458462 {"ShowControl" , (PyCFunction )CtlObj_ShowControl , 1 ,
459463 "() -> None" },
460464 {"HideControl" , (PyCFunction )CtlObj_HideControl , 1 ,
@@ -499,6 +503,8 @@ static PyMethodDef CtlObj_methods[] = {
499503 "() -> (SInt32 _rv)" },
500504 {"as_Resource" , (PyCFunction )CtlObj_as_Resource , 1 ,
501505 "Return this Control as a Resource" },
506+ {"DisposeControl" , (PyCFunction )CtlObj_DisposeControl , 1 ,
507+ "() -> None" },
502508 {NULL , NULL , 0 }
503509};
504510
@@ -588,21 +594,6 @@ static PyObject *Ctl_GetNewControl(_self, _args)
588594 return _res ;
589595}
590596
591- static PyObject * Ctl_KillControls (_self , _args )
592- PyObject * _self ;
593- PyObject * _args ;
594- {
595- PyObject * _res = NULL ;
596- WindowPtr theWindow ;
597- if (!PyArg_ParseTuple (_args , "O&" ,
598- WinObj_Convert , & theWindow ))
599- return NULL ;
600- KillControls (theWindow );
601- Py_INCREF (Py_None );
602- _res = Py_None ;
603- return _res ;
604- }
605-
606597static PyObject * Ctl_DrawControls (_self , _args )
607598 PyObject * _self ;
608599 PyObject * _args ;
@@ -663,8 +654,6 @@ static PyMethodDef Ctl_methods[] = {
663654 "(WindowPtr theWindow, Rect boundsRect, Str255 title, Boolean visible, SInt16 value, SInt16 min, SInt16 max, SInt16 procID, SInt32 refCon) -> (ControlHandle _rv)" },
664655 {"GetNewControl" , (PyCFunction )Ctl_GetNewControl , 1 ,
665656 "(SInt16 controlID, WindowPtr owner) -> (ControlHandle _rv)" },
666- {"KillControls" , (PyCFunction )Ctl_KillControls , 1 ,
667- "(WindowPtr theWindow) -> None" },
668657 {"DrawControls" , (PyCFunction )Ctl_DrawControls , 1 ,
669658 "(WindowPtr theWindow) -> None" },
670659 {"UpdateControls" , (PyCFunction )Ctl_UpdateControls , 1 ,
0 commit comments