]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/dialog.cpp
More Motif additions: mdi and sashtest samples now just about work!
[wxWidgets.git] / src / motif / dialog.cpp
index 2d0606b265d64a6576d34c1eacc1bcf4d19596fd..8154065c119df6dba0c50b6f391936a34ebbb032 100644 (file)
@@ -280,10 +280,16 @@ wxDialog::~wxDialog()
 
     // Now process all events, because otherwise
     // this might remain on the screen.
-    XSync(XtDisplay(XtParent((Widget) m_mainWidget)), FALSE);
+    Display* display;
+    if (m_mainWidget)
+      display = XtDisplay((Widget) m_mainWidget);
+    else
+      display = (Display*) wxGetDisplay();
+
+    XSync(display, FALSE);
     XEvent event;
     while (XtAppPending((XtAppContext) wxTheApp->GetAppContext())) {
-      XFlush(XtDisplay((Widget) XtParent((Widget) m_mainWidget)));
+      XFlush(display);
       XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
       XtDispatchEvent(&event);
     }