Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » [SOLVED] OpenGL reference example X11 crash
[SOLVED] OpenGL reference example X11 crash [message #14343] Sat, 23 February 2008 00:00 Go to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi,

I compiled the OpenGL package inside the reference assembly and got a program crash under X11 compiled in debug mode and a total X server crash when compiled in release mode.

I first verified if my GL installation is working with glut examples and it works, so GL library and graphics card is not the problem.

I get the following X11 error message dialog:
X error: BadMatch (invalid parameter attributes)
resource id: 27262979 = 1A00003

and after closing this dialog, a warning one
Heap leaks detected!


I made an xwininfo run on the application window before closing the error dialog:
xwininfo: Window id: 0x1a00001 (has no name)

  Absolute upper-left X:  30
  Absolute upper-left Y:  56
  Relative upper-left X:  6
  Relative upper-left Y:  29
  Width: 682
  Height: 512
  Depth: 24
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +30+56  -312+56  -312-200  +30-200
  -geometry 682x512+30+56

I hope somebody understands what's going on and can help me trace down the problem.

By the way, is it running under Linux ?

FreeBSD 6, 801.r105

Matthias

[Updated on: Mon, 25 February 2008 21:52]

Report message to a moderator

Re: [BUG] OpenGL reference example X11 crash [message #14383 is a reply to message #14343] Sun, 24 February 2008 19:02 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
I debugged it up to the crash point.
Back trace output is:

Upp::Ctrl::GetWindow (this=0xbfbfea98) at CtrlCore.h:768
Upp::GLCtrl::AfterInit (this=0xbfbfea98, Error=false) at X11GLCtrl.cpp:128
Upp::DHCtrl::Init (this=0xbfbfea98) at X11DHCtrl.cpp:249
Upp::DHCtrl::State (this=0xbfbfea98, reason=13) at X11DHCtrl.cpp:304
Upp::Ctrl::StateDeep (this=0xbfbfea98, reason=13) at Ctrl.cpp:173
Upp::Ctrl::StateDeep (this=0xbfbfe97c, reason=13) at Ctrl.cpp:175
Upp::Ctrl::StateH (this=0xbfbfe97c, reason=13) at Ctrl.cpp:186
Upp::Ctrl::WndShow (this=0xbfbfe97c, b=true) at X11Wnd.cpp:540
Upp::TopWindow::Open (this=0xbfbfe97c, owner=0x0) at TopWinX11.cpp:216
Upp::TopWindow::Open (this=0xbfbfe97c) at TopWinX11.cpp:259
GuiMainFn_ () at /home/masu/upp_uvs/reference/OpenGL/main.cpp:71
main (argc=Error accessing memory address 0x0: Bad address.

Matthias
Re: [BUG] OpenGL reference example X11 crash [message #14388 is a reply to message #14383] Sun, 24 February 2008 21:30 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
I found that the error occurs in a call to
glXMakeCurrent( (Display*)Xdisplay, GetWindow(), WindowContext );

in X11GLCtrl.cpp line 128.

This call is not successful returning a 'BadMatch', I got an explanation from http://caesar.informatik.uni-freiburg.de/people/reisert/open gl/doc/glXMakeCurrent.html:
Quote:

BadMatch is generated if drawable was not created with the same X screen and visual as ctx. It is also generated if drawable is None and ctx is not None.
.

Anybody who knows, what's going wrong here?

Matthias
Re: [BUG] OpenGL reference example X11 crash [message #14413 is a reply to message #14388] Mon, 25 February 2008 20:18 Go to previous message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
I found the problem.

In X11DHCtrl.cpp in Init() class member UserVisualInfo is allocated on heap by calling custom visual info creation function in GLCtrl (CreateVisual()) that returns a pointer to the structure.

This structure is deleted in Init() (from line 156 on) right after using it, but it has to live until it is needed in GLCtrl::AfterInit() in X11GLCtrl.cpp line 111 by calling DHCtrl::GetVisualInfo().

A fix is delete lines 155 to 160 in X11DHCtrl.cpp:
	// Frees VisualInfo
    if (UserVisualInfo)
    {
        XFree( (char *)UserVisualInfo);
        UserVisualInfo = 0;
    }

and add it to DHCtrl destructor.

Of course, I don't know if that imposes any problems elsewhere.

Matthias
Previous Topic: window resized has no CALLBACK?
Next Topic: OpenGL and continous animation
Goto Forum:
  


Current Time: Thu Mar 28 11:45:18 CET 2024

Total time taken to generate the page: 0.00880 seconds