|
List Info
Thread: Hanging references
|
|
| Hanging references |
  Denmark |
2007-07-30 11:56:37 |
Hi all,
I've got an annoying problem that I'm sure comes up often
but my
Google-fu is failing me on this one.
What is the best way to track down hanging references? That
is, when I
close my wxApp, it doesn't close. Either it doesn't return
control to
the command line or the debugger. I've seen this before
when I've
forgotten to Destroy() an object (usually a dialog box) here
or there.
Is there a good way to find these objects? FWIW, we use the
Wing IDE
and associated debugger ... But the stack data returned by
the debugger
when it hangs doesn't contain anything that points me in the
right
direction. And, yes, I'm trapping the OnClose, but 1) I
have
event.Skip() and 2) when I comment out the trapping, it
still hangs.
Any pointers?
Thanks,
Anthony.
--
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
CANADA
Email: Anthony.Floyd convergent.ca | Tel: 604-822-9682
WWW: http://www.convergent.ca
| Fax: 604-822-9659
CMT is hiring: See http://www.convergent.ca
for details
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: Hanging references |

|
2007-07-30 12:39:15 |
On 7/30/07, Anthony M. Floyd <Anthony.Floyd convergent.ca> wrote:
> Hi all,
>
> I've got an annoying problem that I'm sure comes up
often but my
> Google-fu is failing me on this one.
>
> What is the best way to track down hanging references?
That is, when I
> close my wxApp, it doesn't close. Either it doesn't
return control to
> the command line or the debugger. I've seen this
before when I've
> forgotten to Destroy() an object (usually a dialog box)
here or there.
> Is there a good way to find these objects? FWIW, we
use the Wing IDE
> and associated debugger ... But the stack data returned
by the debugger
> when it hangs doesn't contain anything that points me
in the right
> direction. And, yes, I'm trapping the OnClose, but 1)
I have
> event.Skip() and 2) when I comment out the trapping, it
still hangs.
>
> Any pointers?
>
> Thanks,
> Anthony.
try wx.GetApp().GetTopWindow(). This will return an
(arbitrary) top
level window if any are present.
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: Hanging references |

|
2007-07-30 13:27:45 |
Hi Anthony,
On 7/30/07, Chris Mellon wrote:
> On 7/30/07, Anthony M. Floyd <Anthony.Floyd convergent.ca> wrote:
> > Hi all,
> >
> > I've got an annoying problem that I'm sure comes
up often but my
> > Google-fu is failing me on this one.
> >
> > What is the best way to track down hanging
references? That is, when I
> > close my wxApp, it doesn't close. Either it
doesn't return control to
> > the command line or the debugger. I've seen this
before when I've
> > forgotten to Destroy() an object (usually a dialog
box) here or there.
> > Is there a good way to find these objects? FWIW,
we use the Wing IDE
> > and associated debugger ... But the stack data
returned by the debugger
> > when it hangs doesn't contain anything that points
me in the right
> > direction. And, yes, I'm trapping the OnClose,
but 1) I have
> > event.Skip() and 2) when I comment out the
trapping, it still hangs.
> >
> > Any pointers?
> >
> > Thanks,
> > Anthony.
>
>
> try wx.GetApp().GetTopWindow(). This will return an
(arbitrary) top
> level window if any are present.
I would also try wx.GetTopLevelWindows(), together with
Chris' suggestion.
Andrea.
"Imagination Is The Only Weapon In The War Against
Reality."
http://xoomer.alic
e.it/infinity77/
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: Hanging references |
  United States |
2007-07-30 13:30:15 |
Anthony M. Floyd wrote:
> Hi all,
>
> I've got an annoying problem that I'm sure comes up
often but my
> Google-fu is failing me on this one.
>
> What is the best way to track down hanging references?
That is, when I
> close my wxApp, it doesn't close. Either it doesn't
return control to
> the command line or the debugger. I've seen this
before when I've
> forgotten to Destroy() an object (usually a dialog box)
here or there.
> Is there a good way to find these objects? FWIW, we
use the Wing IDE
> and associated debugger ... But the stack data returned
by the debugger
> when it hangs doesn't contain anything that points me
in the right
> direction. And, yes, I'm trapping the OnClose, but 1)
I have
> event.Skip() and 2) when I comment out the trapping, it
still hangs.
>
> Any pointers?
My suggestion could be really easy or really hard to
implement,
depending on whether you have your own mixin classes set up
or not (do
you have a common set of code that you mix-in to your
wxPython
subclasses, or not).
Anyway, here goes my theory.
1) Set up an app-global list to contain object references
(don't worry,
most wxPython object references are weakrefs so this in
itself shouldn't
cause dangling references). Additionally, set up some
app-global functions:
_objList = []
def onCreate(evt):
_objList.append(evt.GetEventObject())
def onDestroy(evt):
_objList.remove(evt.GetEventObject())
2) For each object you instantiate, bind the
wx.EVT_WINDOW_CREATE and
wx.EVT_WINDOW_DESTROY events to the above functions:
3) In your onClose() for your main window, take a look at
all the values
in the global _objList, and see if anything sticks out.
In my experience, most frames, controls, and dialogs will
destroy
themselves and not hang the app on close. MessageDialogs are
an
exception, as are other types of dialogs, so as a rule I
explicitly
destroy those when I'm done with them.
There could certainly be some non-dialog control that is
hanging your
app shutdown, and the above procedure should (theoretically,
at least)
lead you to finding it. You could iterate that list and
explicitly
destroy all of the windows listed, and then see if the app
shuts down or
not, just to make sure you are barking up the right tree or
not, for one.
HTH
--
pkm ~ http://paulmcnett.com
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
[1-4]
|
|