26b05c4
diff -up wxPython-src-3.0.2.0/wxPython/src/helpers.cpp.getxwindowcrash wxPython-src-3.0.2.0/wxPython/src/helpers.cpp
26b05c4
--- wxPython-src-3.0.2.0/wxPython/src/helpers.cpp.getxwindowcrash	2014-10-13 18:37:52.000000000 -0400
26b05c4
+++ wxPython-src-3.0.2.0/wxPython/src/helpers.cpp	2015-01-03 22:05:35.936010783 -0500
26b05c4
@@ -29,9 +29,19 @@
26b05c4
 #include <gtk/gtk.h>
26b05c4
 #include <gdk/gdkx.h>
26b05c4
 #ifdef __WXGTK3__
26b05c4
-#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
26b05c4
-                          GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_wxwindow)) :	\
26b05c4
-                          GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_widget))
26b05c4
+// Unlike GDK_WINDOW_XWINDOW, GDK_WINDOW_XID can't handle a NULL, so check 1st
26b05c4
+static XID GetXWindow(wxWindow* wxwin) {
26b05c4
+    if ((wxwin)->m_wxwindow) {
26b05c4
+        if (gtk_widget_get_window((wxwin)->m_wxwindow))
26b05c4
+            return GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_wxwindow));
26b05c4
+        return 0;    
26b05c4
+    }
26b05c4
+    else {
26b05c4
+        if (gtk_widget_get_window((wxwin)->m_widget))
26b05c4
+            return GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_widget));
26b05c4
+        return 0;
26b05c4
+    }
26b05c4
+}
26b05c4
 #else
26b05c4
 #define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
26b05c4
                           GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \