X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dfad0599246651d4994e348d868a3e65613c7379..8704bf74fba8523e2e174bd5a8195b5202009cd0:/src/motif/dialog.cpp diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 2d0606b265..8154065c11 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -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); }