From a71b5697ad1d540305512bdac093adce2e219cd2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 19 Oct 2009 14:01:34 +0000 Subject: [PATCH] fix drag-and-drop window traversal to handle menus and other unrealized windows svn: r16365 --- src/wxxt/src/Windows/Window.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/wxxt/src/Windows/Window.cc b/src/wxxt/src/Windows/Window.cc index ecfef4f77d..4835a77cfc 100644 --- a/src/wxxt/src/Windows/Window.cc +++ b/src/wxxt/src/Windows/Window.cc @@ -2513,19 +2513,22 @@ wxWindow *wxWindow::FindChildByWidget(Widget w) wxChildNode *node, *next; wxWindow *r; - if ((w == X->frame) - || (w == X->handle)) - return this; + if (X) { + if ((w == X->frame) + || (w == X->handle)) + return this; + } - - for (node = children->First(); node; node = next) { - wxWindow *child; - next = node->Next(); - child = (wxWindow*)(node->Data()); - if (child) { - r = child->FindChildByWidget(w); - if (r) - return r; + if (children) { + for (node = children->First(); node; node = next) { + wxWindow *child; + next = node->Next(); + child = (wxWindow*)(node->Data()); + if (child) { + r = child->FindChildByWidget(w); + if (r) + return r; + } } }