1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

do not provide functions used as destructor of classes as public methods

* python/generator.py: do not provide functions used as destructor
  of classes as public methods to avoid double-free problem like
  in bug #145185
Daniel
This commit is contained in:
Daniel Veillard
2004-07-01 09:36:26 +00:00
parent 96d2effc73
commit d69cc8174e
4 changed files with 252 additions and 241 deletions

View File

@ -1,3 +1,9 @@
Thu Jul 1 11:34:10 CEST 2004 Daniel Veillard <daniel@veillard.com>
* python/generator.py: do not provide functions used as destructor
of classes as public methods to avoid double-free problem like
in bug #145185
Wed Jun 30 19:45:23 HKT 2004 William Brack <wbrack@mmm.com.hk> Wed Jun 30 19:45:23 HKT 2004 William Brack <wbrack@mmm.com.hk>
* xmlschemas.c, xmlschemastypes.c: warning message cleanup. * xmlschemas.c, xmlschemastypes.c: warning message cleanup.

View File

@ -256,7 +256,7 @@
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* Define if compiler has function prototypes */ /* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES #undef PROTOTYPES
/* Determine what socket length (socklen_t) data type is */ /* Determine what socket length (socklen_t) data type is */
@ -274,6 +274,9 @@
/* Using the Win32 Socket implementation */ /* Using the Win32 Socket implementation */
#undef _WINSOCKAPI_ #undef _WINSOCKAPI_
/* Define like PROTOTYPES; this can be used by system headers. */
#undef __PROTOTYPES
/* Win32 Std C name mangling work-around */ /* Win32 Std C name mangling work-around */
#undef snprintf #undef snprintf

View File

@ -1037,17 +1037,25 @@ def buildWrappers():
classes.write(" self.%s = None\n" % ref[1]) classes.write(" self.%s = None\n" % ref[1])
classes.write(" if _obj != None:self._o = _obj;return\n") classes.write(" if _obj != None:self._o = _obj;return\n")
classes.write(" self._o = None\n\n"); classes.write(" self._o = None\n\n");
destruct=None
if classes_destructors.has_key(classname): if classes_destructors.has_key(classname):
classes.write(" def __del__(self):\n") classes.write(" def __del__(self):\n")
classes.write(" if self._o != None:\n") classes.write(" if self._o != None:\n")
classes.write(" libxml2mod.%s(self._o)\n" % classes.write(" libxml2mod.%s(self._o)\n" %
classes_destructors[classname]); classes_destructors[classname]);
classes.write(" self._o = None\n\n"); classes.write(" self._o = None\n\n");
destruct=classes_destructors[classname]
flist = function_classes[classname] flist = function_classes[classname]
flist.sort(functionCompare) flist.sort(functionCompare)
oldfile = "" oldfile = ""
for info in flist: for info in flist:
(index, func, name, ret, args, file) = info (index, func, name, ret, args, file) = info
#
# Do not provide as method the destructors for the class
# to avoid double free
#
if name == destruct:
continue;
if file != oldfile: if file != oldfile:
if file == "python_accessor": if file == "python_accessor":
classes.write(" # accessors for %s\n" % (classname)) classes.write(" # accessors for %s\n" % (classname))

View File

@ -635,6 +635,56 @@ Class xmlDoc(xmlNode)
# functions from module xpointer # functions from module xpointer
xpointerNewContext() xpointerNewContext()
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlAttribute(xmlNode)
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlElement(xmlNode)
Class xmlAttr(xmlNode) Class xmlAttr(xmlNode)
@ -653,13 +703,95 @@ Class xmlAttr(xmlNode)
# functions from module valid # functions from module valid
removeID() removeID()
removeRef() removeRef()
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlReg() Class xmlReg()
# functions from module xmlregexp # functions from module xmlregexp
regexpExec() regexpExec()
regexpFreeRegexp()
regexpIsDeterminist() regexpIsDeterminist()
regexpPrint() regexpPrint()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgValidCtxt() Class relaxNgValidCtxt()
# functions from module relaxng # functions from module relaxng
@ -668,6 +800,73 @@ Class relaxNgValidCtxt()
relaxNGValidatePopElement() relaxNGValidatePopElement()
relaxNGValidatePushCData() relaxNGValidatePushCData()
relaxNGValidatePushElement() relaxNGValidatePushElement()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class parserCtxt(parserCtxtCore) Class parserCtxt(parserCtxtCore)
@ -775,92 +974,6 @@ Class xmlDtd(xmlNode)
dtdElementDesc() dtdElementDesc()
dtdQAttrDesc() dtdQAttrDesc()
dtdQElementDesc() dtdQElementDesc()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGFreeParserCtxt()
relaxNGParse()
relaxParserSetFlag()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
freeCatalog()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlNs(xmlNode) Class xmlNs(xmlNode)
@ -884,6 +997,40 @@ Class xmlNs(xmlNode)
# functions from module xpathInternals # functions from module xpathInternals
xpathNodeSetFreeNs() xpathNodeSetFreeNs()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGParse()
relaxParserSetFlag()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()
# functions from module tree
nodeDumpOutput()
saveFileTo()
saveFormatFileTo()
# functions from module xmlIO
write()
writeString()
Class xmlTextReaderLocator() Class xmlTextReaderLocator()
# functions from module xmlreader # functions from module xmlreader
@ -911,159 +1058,6 @@ Class URI()
user() user()
# functions from module uri # functions from module uri
freeURI()
parseURIReference() parseURIReference()
printURI() printURI()
saveUri() saveUri()
Class xmlAttribute(xmlNode)
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlElement(xmlNode)
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGFree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
freeParserInputBuffer()
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()
# functions from module tree
nodeDumpOutput()
saveFileTo()
saveFormatFileTo()
# functions from module xmlIO
write()
writeString()