+#----------------------------------------------------------------------------
+
+
+class _wxPyDeadObject:
+ """
+ Instances of wx objects that are OOR capable will have their __class__
+ changed to this class when the C++ object is deleted. This should help
+ prevent crashes due to referencing a bogus C++ pointer.
+ """
+ def __repr__( self ):
+ if not hasattr(self, "_name"):
+ self._name = "[unknown]"
+ return 'wxPython wrapper for deleted %s object!!! Programming logic error' % self._name
+
+ def __getattr__( self, *args ):
+ if not hasattr(self, "_name"):
+ self._name = "[unknown]"
+ raise ValueError, 'Attempt to access attribute of a deleted %s object' % self._name
+
+