Ticket #16765: wxPython-3.0.2.0-getxwindowcrash.patch

File wxPython-3.0.2.0-getxwindowcrash.patch, 1.2 KB (added by swt2c, 6 years ago)
  • wxPython-src-3.0.2.0/wxPython/src/helpers.cpp

    diff -up wxPython-src-3.0.2.0/wxPython/src/helpers.cpp.getxwindowcrash wxPython-src-3.0.2.0/wxPython/src/helpers.cpp
    old new  
    2929#include <gtk/gtk.h>
    3030#include <gdk/gdkx.h>
    3131#ifdef __WXGTK3__
    32 #define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
    33                           GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_wxwindow)) :  \
    34                           GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_widget))
     32// Unlike GDK_WINDOW_XWINDOW, GDK_WINDOW_XID can't handle a NULL, so check 1st
     33static XID GetXWindow(wxWindow* wxwin) {
     34    if ((wxwin)->m_wxwindow) {
     35        if (gtk_widget_get_window((wxwin)->m_wxwindow))
     36            return GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_wxwindow));
     37        return 0;   
     38    }
     39    else {
     40        if (gtk_widget_get_window((wxwin)->m_widget))
     41            return GDK_WINDOW_XID(gtk_widget_get_window((wxwin)->m_widget));
     42        return 0;
     43    }
     44}
    3545#else
    3646#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
    3747                          GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \