[ wxwindows-Bugs-1579954 ] incref problem with GetChildren

SourceForge.net noreply at sourceforge.net
Wed Oct 18 12:31:31 PDT 2006


Bugs item #1579954, was opened at 2006-10-18 21:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1579954&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxPython specific
Group: Must fix
Status: Open
Resolution: None
Priority: 5
Submitted By: F. Oliver Gathmann (gathmann)
Assigned to: Robin Dunn (robind)
Summary: incref problem with GetChildren

Initial Comment:
Calling wx.Window.GetChildren() increases the refcount
of a widget's children even if the return value is
discarded. This is illustrated by the following code
sample:

import wx
import sys

app = wx.PySimpleApp()

frame = wx.Frame(None, -1, 'my dialog')
panel = wx.Panel(frame, -1)
frame.Show(True)

print 'refcount before call to GetChildren():',
sys.getrefcount(panel)
frame.GetChildren()
print 'refcount after call to GetChildren():',
sys.getrefcount(panel)


This produces the following output on my linux box with
both the current wxPython 2.6.3.2 and the
2.7.0.1pre.20061006 preview build:

refcount before call to GetChildren(): 3
refcount after call to GetChildren(): 4

The problem appears to be that (in helpers.cpp) during
the call to wxPy_ConvertList, wxPyMake_wxObject
explicitly increfs each object (=child window) and then
it is increfed *again* in the call to PyList_Append.
Not sure what the right fix is here...


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1579954&group_id=9863




More information about the wx-dev mailing list