On Thu, Oct 13, 2011 at 11:37:13PM -0400, Yaroslav Halchenko wrote:
> how lucky I am that I have attached a complete terminal session dump to
> the initial report
> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=script.yoh.14452.20100326.1546;att=1;bug=575536
> thus avoided myself now a hassle to rebuild it all without optimization
> and stripping ;)

OK, cool - I see what is happening here then.

When the wxGLCanvas is created, its ctor calls wxGLCanvas::Create()
which fails to get a GL visual and returns false before it gets to the
call which actually sets the parent class up:

    wxWindow::Create(parent, id, pos, size, style, name);

The wxGLCanvas ctor ignores the return value of wxGLCanvas::Create() and
it looks to me like there's no API call for the user to detect that the
wxGLCanvas object isn't really valid.

Simplest thing to try to me seems to be moving this call earlier, since
all its arguments are parameters of wxGLCanvas::Create().  Can you try
the attached patch?

Cheers,
    Olly
diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp
index 24ab43f..332fa50 100644
--- a/src/gtk/glcanvas.cpp
+++ b/src/gtk/glcanvas.cpp
@@ -299,6 +299,8 @@ bool wxGLCanvas::Create( wxWindow *parent,
                          int *attribList,
                          const wxPalette& palette)
 {
+    wxWindow::Create(parent, id, pos, size, style, name);
+
     m_sharedContext = (wxGLContext*)shared;  // const_cast
     m_sharedContextOf = (wxGLCanvas*)shared_context_of;  // const_cast
     m_glContext = (wxGLContext*) NULL;
@@ -358,7 +360,6 @@ bool wxGLCanvas::Create( wxWindow *parent,
     unsigned sig_id = g_signal_lookup("parent-set", GTK_TYPE_WIDGET);
     g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL);
 
-    wxWindow::Create(parent, id, pos, size, style, name);
     m_glWidget = m_wxwindow;
 
     gtk_widget_set_double_buffered( m_glWidget, FALSE );

Reply via email to