]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/window.cpp
Added workaround for life crashing in toolbar deletion.
[wxWidgets.git] / src / motif / window.cpp
index f251d7492e6022f273483a64166d85c59cb22111..4ec50c783906d6989e9fadaaf826ad121dc650f6 100644 (file)
@@ -408,10 +408,9 @@ wxWindow::~wxWindow()
         if (w)
         {
             XtDestroyWidget(w);
+           m_drawingArea = (WXWidget) 0;
         }
 
-        m_mainWidget = (WXWidget) 0;
-
         // Only if we're _really_ a canvas (not a dialog box/panel)
         if (m_scrolledWindow)
         {
@@ -421,14 +420,19 @@ wxWindow::~wxWindow()
         if (m_hScrollBar)
         {
             wxDeleteWindowFromTable((Widget) m_hScrollBar);
+           XtUnmanageChild((Widget) m_hScrollBar);
         }
         if (m_vScrollBar)
         {
             wxDeleteWindowFromTable((Widget) m_vScrollBar);
+           XtUnmanageChild((Widget) m_vScrollBar);
         }
 
-        UnmanageAndDestroy(m_hScrollBar);
-        UnmanageAndDestroy(m_vScrollBar);
+        if (m_hScrollBar)
+           XtDestroyWidget((Widget) m_hScrollBar);
+        if (m_vScrollBar)
+           XtDestroyWidget((Widget) m_vScrollBar);
+
         UnmanageAndDestroy(m_scrolledWindow);
 
         if (m_borderWidget)
@@ -451,7 +455,8 @@ wxWindow::~wxWindow()
         //   wxSCROLL[WIN]_THUMBRELEASE events. Also it was reported
         //   that this call crashed wxMotif under OS/2, so it seems
         //   that leaving it out is the right thing to do.
-//        XtDestroyWidget((Widget) GetMainWidget());
+        // SN, Feb/2000: newgrid/griddemo shows why it is needed :-(
+        XtDestroyWidget((Widget) GetMainWidget());
         SetMainWidget((WXWidget) NULL);
     }
 }
@@ -572,7 +577,7 @@ void wxWindow::DestroyScrollbar(wxOrientation orientation)
             XtDestroyWidget((Widget) m_vScrollBar);
         }
         m_vScrollBar = (WXWidget) 0;
-        m_vScroll = TRUE;
+        m_vScroll = FALSE;
 
         XtVaSetValues((Widget) m_scrolledWindow,
             XmNverticalScrollBar, (Widget) 0,