mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Fixed a nasty bug where FindControl could return a reference to a
destroyed python object.
This commit is contained in:
parent
da6a971994
commit
c574b43d35
4 changed files with 7 additions and 4 deletions
|
|
@ -95,7 +95,7 @@ CtlObj_Convert(v, p_itself)
|
||||||
static void CtlObj_dealloc(self)
|
static void CtlObj_dealloc(self)
|
||||||
ControlObject *self;
|
ControlObject *self;
|
||||||
{
|
{
|
||||||
/* Cleanup of self->ob_itself goes here */
|
SetCRefCon(self->ob_itself, (long)0); /* Make it forget about us */
|
||||||
PyMem_DEL(self);
|
PyMem_DEL(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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',
|
f = Function(ControlRef, 'NewControl',
|
||||||
(WindowRef, 'theWindow', InMode),
|
(WindowRef, 'theWindow', InMode),
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@ import addpack
|
||||||
addpack.addpack(':Tools:bgen:bgen')
|
addpack.addpack(':Tools:bgen:bgen')
|
||||||
|
|
||||||
from scantools import Scanner
|
from scantools import Scanner
|
||||||
|
from bgenlocations import TOOLBOXDIR
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
input = "Controls.h"
|
input = "Controls.h"
|
||||||
output = "ctlgen.py"
|
output = "ctlgen.py"
|
||||||
defsoutput = "Controls.py"
|
defsoutput = TOOLBOXDIR + "Controls.py"
|
||||||
scanner = MyScanner(input, output, defsoutput)
|
scanner = MyScanner(input, output, defsoutput)
|
||||||
scanner.scan()
|
scanner.scan()
|
||||||
scanner.close()
|
scanner.close()
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,9 @@ class MyObjectDefinition(GlobalObjectDefinition):
|
||||||
def outputInitStructMembers(self):
|
def outputInitStructMembers(self):
|
||||||
GlobalObjectDefinition.outputInitStructMembers(self)
|
GlobalObjectDefinition.outputInitStructMembers(self)
|
||||||
Output("SetCRefCon(itself, (long)it);")
|
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
|
# Create the generator groups and link them
|
||||||
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
|
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
|
||||||
object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
|
object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue