Index: vtkXRenderWindowInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkXRenderWindowInteractor.cxx,v
retrieving revision 1.138
diff -u -r1.138 vtkXRenderWindowInteractor.cxx
--- vtkXRenderWindowInteractor.cxx	12 Mar 2009 13:12:39 -0000	1.138
+++ vtkXRenderWindowInteractor.cxx	24 Apr 2009 19:41:47 -0000
@@ -96,11 +96,6 @@
   this->OwnTop = 0;
   this->OwnApp = 0;
   this->TopLevelShell = NULL;
-  this->BreakLoopFlag = 0;
-  this->BreakXtLoopCallback = vtkCallbackCommand::New();
-  this->BreakXtLoopCallback->SetClientData(this);
-  this->BreakXtLoopCallback->SetCallback(
-    &vtkXRenderWindowInteractor::BreakXtLoop);
 }
 
 //-------------------------------------------------------------------------
@@ -113,8 +108,6 @@
     XtDestroyWidget(this->Top);
     }
 
-  this->BreakXtLoopCallback->Delete();
-  
   if (vtkXRenderWindowInteractor::App)
     {
     if(vtkXRenderWindowInteractor::NumAppInitialized == 1)
@@ -186,31 +179,25 @@
 }
 
 //-------------------------------------------------------------------------
-// This function replaces TerminateApp() if Start() is called.
-// This way, when the user hits the exit key, Start() returns
-// and the application continues instead of calling exit().
-// With this change, it is possible to have clean-up code after
-// the interactor loop.
-void vtkXRenderWindowInteractor::BreakXtLoop(vtkObject*, unsigned long,
-                                             void* viren, void*)
-{
-  vtkXRenderWindowInteractor *iren =
-    static_cast<vtkXRenderWindowInteractor*>(viren);
-
-  iren->SetBreakLoopFlag(1);
-
-  // Send a VTK_BreakXtLoop ClientMessage event so we pop out of the current
-  // call to XtAppNextEvent and notice that BreakLoopFlag has been set...
-  //
+// TerminateApp() notifies the event loop to exit.
+// The event loop is started by Start() or by one own's method.
+// This results in Start() returning to its caller.
+void vtkXRenderWindowInteractor::TerminateApp()
+{
+  this->BreakLoopFlag = 1;
+
+  // Send a VTK_BreakXtLoop ClientMessage event to be sure we pop out of the
+  // event loop.  This "wakes up" the event loop.  Otherwise, it might sit idle 
+  // waiting for an event before realizing an exit was requested.
   XClientMessageEvent client;
   memset(&client, 0, sizeof(client));
 
   client.type = ClientMessage;
   //client.serial; //leave zeroed
   //client.send_event; //leave zeroed
-  client.display = iren->DisplayId;
-  client.window = iren->WindowId;
-  client.message_type = XInternAtom(iren->DisplayId, "VTK_BreakXtLoop",
+  client.display = this->DisplayId;
+  client.window = this->WindowId;
+  client.message_type = XInternAtom(this->DisplayId, "VTK_BreakXtLoop",
     False);
   client.format = 32; // indicates size of data chunks: 8, 16 or 32 bits...
   //client.data; //leave zeroed
@@ -221,9 +208,9 @@
 }
 
 //-------------------------------------------------------------------------
-// This will start up the X event loop and never return. If you
+// This will start up the X event loop. If you
 // call this method it will loop processing X events until the
-// application is exited.
+// loop is exited.
 void vtkXRenderWindowInteractor::Start()
 {
   // Let the compositing handle the event loop if it wants to.
@@ -242,16 +229,15 @@
     return;
     }
 
-  unsigned long ExitTag = this->AddObserver(vtkCommand::ExitEvent, this->BreakXtLoopCallback);
   this->BreakLoopFlag = 0;
-  do 
+  do
     {
     XEvent event;
     XtAppNextEvent(vtkXRenderWindowInteractor::App, &event);
     XtDispatchEvent(&event);
     }
   while (this->BreakLoopFlag == 0);
-  this->RemoveObserver(ExitTag);
+
 }
 
 //-------------------------------------------------------------------------
@@ -474,9 +460,9 @@
     {
     os << indent << "App: (none)\n";
     }
-
-  os << indent << "BreakLoopFlag: " 
-     << (this->BreakLoopFlag ? "On\n" : "Off\n");
+    
+  os << indent << "BreakLoopFlag: "                                                           
+     << (this->BreakLoopFlag ? "On\n" : "Off\n");     
 }
 
 //-------------------------------------------------------------------------
Index: vtkXRenderWindowInteractor.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkXRenderWindowInteractor.h,v
retrieving revision 1.75
diff -u -r1.75 vtkXRenderWindowInteractor.h
--- vtkXRenderWindowInteractor.h	14 Aug 2008 18:17:11 -0000	1.75
+++ vtkXRenderWindowInteractor.h	24 Apr 2009 19:41:47 -0000
@@ -61,16 +61,7 @@
 
   // Description:
   // Call exit on 'q','e' keypress. Want more ???
-  void TerminateApp(void) { exit(0); }
-
-  // Description:
-  // The BreakLoopFlag is checked in the Start() method.
-  // Setting it to anything other than zero will cause
-  // the interactor loop to terminate and return to the
-  // calling function.
-  vtkSetMacro(BreakLoopFlag, int);
-  vtkGetMacro(BreakLoopFlag, int);
-  vtkBooleanMacro(BreakLoopFlag, int);
+  void TerminateApp();
 
   // Description: 
   // Initializes the event handlers using an XtAppContext that you have
@@ -184,14 +175,12 @@
   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
   virtual int InternalDestroyTimer(int platformTimerId);
 
-  int BreakLoopFlag;
   XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
                           XtTimerCallbackProc proc, XtPointer client_data) ;
   void Timer(XtPointer client_data, XtIntervalId *id); 
   void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
-
-  vtkCallbackCommand* BreakXtLoopCallback;
-  static void BreakXtLoop(vtkObject*, unsigned long, void*, void*);
+  
+  int BreakLoopFlag;
 
 private:
   vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);  // Not implemented.
Index: vtkXRenderWindowTclInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkXRenderWindowTclInteractor.cxx,v
retrieving revision 1.58
diff -u -r1.58 vtkXRenderWindowTclInteractor.cxx
--- vtkXRenderWindowTclInteractor.cxx	24 Apr 2009 16:41:16 -0000	1.58
+++ vtkXRenderWindowTclInteractor.cxx	24 Apr 2009 19:41:47 -0000
@@ -297,17 +297,14 @@
     return;
     }
 
-  unsigned long ExitTag = this->AddObserver(vtkCommand::ExitEvent, this->BreakXtLoopCallback);
   this->BreakLoopFlag = 0;
   do
     {
     Tk_DoOneEvent(0);
     }
   while (this->BreakLoopFlag == 0);
-  this->RemoveObserver(ExitTag);
 }
 
-
 //-------------------------------------------------------------------------
 int vtkXRenderWindowTclInteractor::InternalCreateTimer(int timerId,
                                                        int vtkNotUsed(timerType),
