]> granicus.if.org Git - python/commitdiff
Fixed a nasty bug where FindControl could return a reference to a
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 12 Apr 1996 16:26:59 +0000 (16:26 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 12 Apr 1996 16:26:59 +0000 (16:26 +0000)
destroyed python object.

Mac/Modules/ctl/Ctlmodule.c
Mac/Modules/ctl/ctlgen.py
Mac/Modules/ctl/ctlscan.py
Mac/Modules/ctl/ctlsupport.py

index bc690cd9bc48f1d9062d1aa91073f05925362c04..33111f516479b8f1ac2a07a6f38581ed52343ebd 100644 (file)
@@ -95,7 +95,7 @@ CtlObj_Convert(v, p_itself)
 static void CtlObj_dealloc(self)
        ControlObject *self;
 {
-       /* Cleanup of self->ob_itself goes here */
+       SetCRefCon(self->ob_itself, (long)0); /* Make it forget about us */
        PyMem_DEL(self);
 }
 
index 451253aada33583ca80dcb795816ac3af998e9c0..eefd1752a67778f4824af3d37bb4e470ea0abe22 100644 (file)
@@ -1,4 +1,4 @@
-# Generated from 'flap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Controls.h'
+# Generated from 'Sap:CW8 Gold:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Controls.h'
 
 f = Function(ControlRef, 'NewControl',
     (WindowRef, 'theWindow', InMode),
index e36db2c88f6f7377fffd271e4cc5e04e1af2bdae..661cbfebc2b92ecc3531c8eeb0f78ba1b4132875 100644 (file)
@@ -3,11 +3,12 @@ import addpack
 addpack.addpack(':Tools:bgen:bgen')
 
 from scantools import Scanner
+from bgenlocations import TOOLBOXDIR
 
 def main():
        input = "Controls.h"
        output = "ctlgen.py"
-       defsoutput = "Controls.py"
+       defsoutput = TOOLBOXDIR + "Controls.py"
        scanner = MyScanner(input, output, defsoutput)
        scanner.scan()
        scanner.close()
index c87922a109da0f155b36231b27cb9de52a023c09..cef9f8a40b57f5185a9c48691997354c7e430adb 100644 (file)
@@ -68,7 +68,9 @@ class MyObjectDefinition(GlobalObjectDefinition):
        def outputInitStructMembers(self):
                GlobalObjectDefinition.outputInitStructMembers(self)
                Output("SetCRefCon(itself, (long)it);")
-
+       def outputCleanupStructMembers(self):
+               Output("SetCRefCon(self->ob_itself, (long)0); /* Make it forget about us */")
+               
 # Create the generator groups and link them
 module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
 object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)