Fix crash in OpenGL pyramid example if context creation fails
Initialize context pointers to null so that we don't delete uninitialized junk later. See #16910. Closes https://github.com/wxWidgets/wxWidgets/pull/233
This commit is contained in:
committed by
Vadim Zeitlin
parent
5ab459e4c7
commit
e2fb055329
@@ -552,6 +552,7 @@ wxIMPLEMENT_CLASS(wxGLContext, wxObject);
|
||||
wxGLContext::wxGLContext(wxGLCanvas *win,
|
||||
const wxGLContext *other,
|
||||
const wxGLContextAttrs *ctxAttrs)
|
||||
: m_glContext(NULL)
|
||||
{
|
||||
const int* contextAttribs = NULL;
|
||||
bool needsARB = false;
|
||||
@@ -614,8 +615,11 @@ wxGLContext::wxGLContext(wxGLCanvas *win,
|
||||
wxGLContext::~wxGLContext()
|
||||
{
|
||||
// note that it's ok to delete the context even if it's the current one
|
||||
if ( m_glContext )
|
||||
{
|
||||
wglDeleteContext(m_glContext);
|
||||
}
|
||||
}
|
||||
|
||||
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
||||
{
|
||||
|
@@ -359,6 +359,7 @@ wxGLAttributes& wxGLAttributes::Defaults()
|
||||
wxGLContext::wxGLContext(wxGLCanvas *win,
|
||||
const wxGLContext *other,
|
||||
const wxGLContextAttrs *ctxAttrs)
|
||||
: m_glContext(NULL)
|
||||
{
|
||||
const int* contextAttribs = NULL;
|
||||
int ctxSize = 0;
|
||||
|
@@ -454,6 +454,7 @@ wxIMPLEMENT_CLASS(wxGLContext, wxObject);
|
||||
wxGLContext::wxGLContext(wxGLCanvas *win,
|
||||
const wxGLContext *other,
|
||||
const wxGLContextAttrs *ctxAttrs)
|
||||
: m_glContext(NULL)
|
||||
{
|
||||
const int* contextAttribs = NULL;
|
||||
Bool x11Direct = True;
|
||||
|
Reference in New Issue
Block a user