Page 1 of 1

CELayoutEditor crash when opening a layout

Posted: Tue Aug 31, 2010 19:45
by IR3uL
Whenever i open (or create a new) layout, the editor crash and trows this error in the console:

Code: Select all

The program 'CELayoutEditor' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 35600 error_code 9 request_code 137 minor_code 8)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)


Here is the log: http://www.pasteall.org/15363/

Re: CELayoutEditor crash when opening a layout

Posted: Thu Sep 02, 2010 08:33
by CrazyEddie
I'm not sure of the cause of this issue. First you should be aware that development on the existing editor code had ceased and by and large no further support for that will be provided. A replacement editor will be available fairly soon (a week, maybe two).

I wonder which version of wxWidgets you're using? I believe there are issues when using the 2.9.x versions. The last known / tested compatible version of wxWidgets is 2.8.11.

CE.

Re: CELayoutEditor crash when opening a layout

Posted: Thu Sep 02, 2010 16:57
by IR3uL
CrazyEddie wrote:I'm not sure of the cause of this issue. First you should be aware that development on the existing editor code had ceased and by and large no further support for that will be provided.

If that's the case i won't mind try to fix this, i don't need it atm.

CrazyEddie wrote: A replacement editor will be available fairly soon (a week, maybe two).

Can i get that from svn or something?, in the repository https://crayzedsgui.svn.sourceforge.net ... rayzedsgui there's only the deprecated editor.

CrazyEddie wrote:I wonder which version of wxWidgets you're using? I believe there are issues when using the 2.9.x versions. The last known / tested compatible version of wxWidgets is 2.8.11.


I'm using 2.8.10.1

Re: CELayoutEditor crash when opening a layout

Posted: Sun Sep 05, 2010 08:41
by CrazyEddie
IR3uL wrote:
CrazyEddie wrote: A replacement editor will be available fairly soon (a week, maybe two).

Can i get that from svn or something?, in the repository https://crayzedsgui.svn.sourceforge.net ... rayzedsgui there's only the deprecated editor.

It's not in SVN yet - it will be in a week or two once I'm happy with the initial version. Around the same time some ready to run packages will be released (at least for Mac / Windows), since the new editor is using python, PyQt and also relies on CEGUI python bindings that are yet to be finalised and added to CEGUI, so - at least initially - it may be more difficult to "build" the editor yourselves.

CE.

Re: CELayoutEditor crash when opening a layout

Posted: Tue Sep 07, 2010 17:07
by IR3uL
Ok, i'll have to wait. btw, i will be happy to contribute with Linux packages for OpenSUSE and Arch.

Re: CELayoutEditor crash when opening a layout

Posted: Wed Sep 08, 2010 17:31
by CrazyEddie
Cool. I'm not sure how it's all going to work at the moment to be honest ;) While I'm actually developing this on Linux, since that's my main platform, it's going to require stuff that is not immediately available (mainly the python binding for CEGUI). On Win and Mac we can easily provide ready to go packages that contain everything, since that's the done thing on those platforms, for Linux, ideally we'd be using installed versions of the CEGUI libs and the binding and such. I guess this is something that needs careful consideration - perhaps with an interim solution of some kind until such times as the required components get officially released ;)

CE.

Re: CELayoutEditor crash when opening a layout

Posted: Mon Dec 13, 2010 01:01
by Browser12
EDIT: Solution

Confirmed the fix. Your canvas subclass does indeed use SwapBuffers, but supplies no attribList to the parent constructor. I've fixed this; the only attribute I've supplied is the WX_GL_DOUBLEBUFFER.

The changes I made are below.

Code: Select all

diff -ruN CELayoutEditor-0.7.1-old/inc/EditorCanvas.h CELayoutEditor-0.7.1/inc/EditorCanvas.h
--- CELayoutEditor-0.7.1-old/inc/EditorCanvas.h   2009-12-09 09:46:28.000000000 +0000
+++ CELayoutEditor-0.7.1/inc/EditorCanvas.h   2010-12-12 20:01:22.000000000 +0000
@@ -46,7 +46,7 @@
      ************************************************************************/
     
     /** Constructor.*/
-    EditorCanvas(wxView *view, wxFrame *frame, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
+    EditorCanvas(wxView *view, wxFrame *frame, int *attribList, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
 
     /************************************************************************
      * PUBLIC FUNCTIONS
diff -ruN CELayoutEditor-0.7.1-old/src/EditorCanvas.cpp CELayoutEditor-0.7.1/src/EditorCanvas.cpp
--- CELayoutEditor-0.7.1-old/src/EditorCanvas.cpp   2010-01-01 18:54:45.000000000 +0000
+++ CELayoutEditor-0.7.1/src/EditorCanvas.cpp   2010-12-12 20:00:55.000000000 +0000
@@ -47,7 +47,7 @@
 //////////////////////////////////////////////////////////////////////////
 
 //------------------------------------------------------------------------
-EditorCanvas::EditorCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size) :
+EditorCanvas::EditorCanvas(wxView *v, wxFrame *frame, int *attribList, const wxPoint& pos, const wxSize& size) :
 
 // Store view
 m_view(v),
@@ -58,7 +58,7 @@
 mLastMouseX(-1),
 mLastMouseY(-1),
 
-wxGLCanvas(frame, wx_static_cast(wxGLCanvas*, NULL), -1, pos, size, wxNO_BORDER )
+wxGLCanvas(frame, wx_static_cast(wxGLCanvas*, NULL), -1, pos, size, wxNO_BORDER, _("GLCanvas"), attribList)
 {
     // NOTE: Prefer constructor initialization lists (which are
     // often more efficient) to assignment inside the
diff -ruN CELayoutEditor-0.7.1-old/src/EditorFrame.cpp CELayoutEditor-0.7.1/src/EditorFrame.cpp
--- CELayoutEditor-0.7.1-old/src/EditorFrame.cpp   2010-01-01 18:54:45.000000000 +0000
+++ CELayoutEditor-0.7.1/src/EditorFrame.cpp   2010-12-12 20:02:11.000000000 +0000
@@ -360,7 +360,8 @@
 
     // Create the GLCanvas. This approach provides MDI support maybe in the future
     //EditorCanvas* const canvas = new EditorCanvas(view, this, GetClientAreaOrigin(), wxDefaultSize);
-    EditorCanvas* const canvas = new EditorCanvas(view, this, wxPoint(0,0), wxDefaultSize);
+    int attribList[] = {WX_GL_DOUBLEBUFFER, 0};
+    EditorCanvas* const canvas = new EditorCanvas(view, this, attribList, wxPoint(0,0), wxDefaultSize);
 
     // Tell it about the initial size
     //canvas->changeSize(width + BORDER_SIZE, height + BORDER_SIZE);


/EDIT

I am having the exact same problem as the original poster: same error message, when opening / creating a new layout (I'm assuming this means, "when beginning use of a wxwidgets OpenGL surface".

I built/installed v0.7.1 of the CELayoutEditor and am using the wxgtk v2.8.11-1 package on Arch Linux.

For what it's worth, regarding the error:
I recently was working with a wxWidgets-based project myself (same version of wxgtk), and I got this same X error, BadDrawable yadda yadda, for some time.
It ended up that this happened when I attempted to use the wxGLCanvas::SwapBuffers() function for a canvas that hadn't been initialized properly - that is, the "int attribList[]" that included WX_GL_DOUBLEBUFFER was not passed to my canvas's constructor. This was due to my following what appears to have been out-of-date / incorrect code.

Looking here: http://wiki.wxwidgets.org/WxGLCanvas
You'll see in the example, the overridden constructor does not make use of (or in the first example, even -take-) the "int attribList[]". This caused the aforementioned X error when swapping buffers. (If I compile that example code, it gives me the BadDrawable error).
Others were apparently also encountering this problem lately: https://bugs.launchpad.net/kicad/+bug/6 ... omments/11

Perhaps the wxgtk implementation previously used WX_GL_DOUBLEBUFFER by default, and no longer does so? In any event, I'm sure there are other ways to get this error besides swapping buffers on a canvas that hasn't been initialized with double-buffer capability; thought I'd throw out my own recent experience.

CrazyEddie wrote:I'm not sure of the cause of this issue. First you should be aware that development on the existing editor code had ceased and by and large no further support for that will be provided. A replacement editor will be available fairly soon (a week, maybe two).

I wonder which version of wxWidgets you're using? I believe there are issues when using the 2.9.x versions. The last known / tested compatible version of wxWidgets is 2.8.11.

CE.