KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ORPHANED_GL_OBJECTS Class Reference

Mark a scope whose GL objects have lost the context that owns them. More...

#include <orphaned_gl_objects.h>

Public Member Functions

 ORPHANED_GL_OBJECTS ()
 
 ~ORPHANED_GL_OBJECTS ()
 

Static Public Member Functions

static bool Active ()
 

Private Attributes

bool m_wasOrphaned
 

Static Private Attributes

static bool s_orphaned = false
 

Detailed Description

Mark a scope whose GL objects have lost the context that owns them.

Deleting a GL object requires its own context to be current. A canvas whose native window is already gone cannot make its context current, and every 3D canvas owns an unshared context, so a delete issued then would be executed against whichever context is current and would destroy an unrelated object carrying the same name. Names are released when the owning context is destroyed, so skipping the deletes leaks nothing.

Only the thread holding the context issues GL commands, so no locking is needed here.

Definition at line 34 of file orphaned_gl_objects.h.

Constructor & Destructor Documentation

◆ ORPHANED_GL_OBJECTS()

ORPHANED_GL_OBJECTS::ORPHANED_GL_OBJECTS ( )
inline

Definition at line 37 of file orphaned_gl_objects.h.

References m_wasOrphaned, and s_orphaned.

◆ ~ORPHANED_GL_OBJECTS()

ORPHANED_GL_OBJECTS::~ORPHANED_GL_OBJECTS ( )
inline

Definition at line 43 of file orphaned_gl_objects.h.

References m_wasOrphaned, and s_orphaned.

Member Function Documentation

◆ Active()

static bool ORPHANED_GL_OBJECTS::Active ( )
inlinestatic
Returns
True when GL objects must be released without deleting them.

Definition at line 51 of file orphaned_gl_objects.h.

References s_orphaned.

Referenced by RENDER_3D_RAYTRACE_GL::deletePbo(), RENDER_3D_OPENGL::freeAllLists(), MODEL_3D::~MODEL_3D(), OPENGL_RENDER_LIST::~OPENGL_RENDER_LIST(), and RENDER_3D_OPENGL::~RENDER_3D_OPENGL().

Member Data Documentation

◆ m_wasOrphaned

bool ORPHANED_GL_OBJECTS::m_wasOrphaned
private

Definition at line 57 of file orphaned_gl_objects.h.

Referenced by ORPHANED_GL_OBJECTS(), and ~ORPHANED_GL_OBJECTS().

◆ s_orphaned

bool ORPHANED_GL_OBJECTS::s_orphaned = false
inlinestaticprivate

Definition at line 58 of file orphaned_gl_objects.h.

Referenced by Active(), ORPHANED_GL_OBJECTS(), and ~ORPHANED_GL_OBJECTS().


The documentation for this class was generated from the following file: