Waiting for GLContext to be released

101 views Asked by At

Was passed a set of rendering library that is coded with OSG library and run on Window Environment.

In my program, the renderer exists as a member object in my base class in C++. In my class initiation function, I would do all the neccessary steps to initialize the renderer and use the function this renderer class provide accordingly.

However, I have tried to delete my base class, I presumed the renderer member object would be destroyed along with it. However, when I created another instance of the class, the program would crash when I try to access the rendering function within the renderer.

Have enquired about some opinions on this matter and was told that in Windows, upon deleting the class, the renderer would need to release its glContext and this might be indeterminant time in Windows environment pending upon hardware setup

Is this so? If so, what steps could I take beside amending the rendering source code(if I could get it) to resolve the issue?

Thanks

2

There are 2 answers

0
Spektre On

Your issue is looking more like screwed constructor/destructor or operator= then a GL issue.

  • its just a gues without the actual code to see/test
  • Most likely you are accessing already deleted pointer somewhere
  • check all dynamic member variables and pointers inside your class

Had similar problems in the past so check these

Another possible cause

  • if you are mixing window message code with threads
  • and accessing visual system calls or objects within threads instead of window code
  • that can screw up something in the OS and create unexpected crashes ...
  • at least on windows
0
datenwolf On

Actually not deleting / releasing the OpenGL context will just create some memory leak but nothing more. Leaving the OpenGL context around should not cause a crash. In fact crashes like yours are often the cause of releasing some object, that's still required by some other part of the program, so not releasing stuff should not be a cause for a crash like yours.