the C++ part of wxMenu object has been deleted problem

Hi,
I am using a list to keep menu items on two screens. I need to clean the
list when one screen is deleted. Is there a fuction call to find out the
invalid wxMenu objects on the list to get rid of the error like the C++
part of the wxMenu Object has been deleted attribute access no longer
allowed.
Thanks

Ming

Ming Lan wrote:

Hi, I am using a list to keep menu items on two screens. I need to clean the
list when one screen is deleted. Is there a fuction call to find out the
invalid wxMenu objects on the list to get rid of the error like the C++
part of the wxMenu Object has been deleted attribute access no longer
allowed.

The _wxPyDeadObject class has a __nonzero__ method so this should work:

  for item in theList:
    if not item:
      theList.remove(item)

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!