[wxPython] wxPostEvent Crash

This is another case of having to override the operating system. Windows does
not keep a table of window handles that "used to be valid". A window handle is
essentially a pointer into an internal structure in Windows. When a
application exits, its window handles point into oblivion, and another
application that tries to use one of them explodes.

Microsoft's MFC class library for C++ handles this by always calling a
"GetSafeHandle()" method that calls IsWindow() before returning the handle.
wxWindows should probably be doing the same thing.

Even that isn't completely safe; unlike X, Windows reuses window handles at a
rather rapid rate. If an app exits and another one comes up, the new app is
quite likely to reuse handles from the older app. Your code won't know that.

ยทยทยท

On Tue, 30 Jul 2002 12:44:50 -0400, "Garry Simmons" <simmonsg@symbol.com> wrote:

My application is almost totally event driven since it's very asynchronous.
It basically requests data from server,then posts an event to the
requesting window when the response arrives. The response can arrive in
several pieces over several minutes.

The problem is that Python crashes (Dr. Watson) if the window no longer
exists.

I was hoping wxPython would gracefully just eat the event rather than
crash. I can work around this in my app, but was wondering if this is the
intended behavior.

--
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.