]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/process.cpp
VTK wrapper of vtkRenderWindow for wxPython. Tested on MSW so far.
[wxWidgets.git] / src / common / process.cpp
index 2469953ed217308c06411ceea0fc4fe7db0cd7e7..6440993d20363b7011338c325bab4888058e00ec 100644 (file)
@@ -2,11 +2,11 @@
 // Name:        process.cpp
 // Purpose:     Process termination classes
 // Author:      Guilhem Lavaux
 // Name:        process.cpp
 // Purpose:     Process termination classes
 // Author:      Guilhem Lavaux
-// Modified by:
+// Modified by: Vadim Zeitlin to check error codes, added Detach() method
 // Created:     24/06/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Guilhem Lavaux
 // Created:     24/06/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Guilhem Lavaux
-// Licence:    wxWindows license
+// Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -31,15 +31,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
 
 wxProcess::wxProcess(wxEvtHandler *parent, int id)
 {
 
 wxProcess::wxProcess(wxEvtHandler *parent, int id)
 {
-  if (parent)
-    SetNextHandler(parent);
+    if (parent)
+        SetNextHandler(parent);
 
 
-  m_id = id;
+    m_id = id;
 }
 
 void wxProcess::OnTerminate(int pid, int status)
 {
 }
 
 void wxProcess::OnTerminate(int pid, int status)
 {
-  wxProcessEvent event(m_id, pid, status);
+    wxProcessEvent event(m_id, pid, status);
 
 
-  ProcessEvent(event);
+    if ( !ProcessEvent(event) )
+        delete this;
+    //else: the object which processed the event is responsible for deleting
+    //      us!
+}
+
+void wxProcess::Detach()
+{
+    SetNextHandler(NULL);
 }
 }