From de69a4a3d825b414dad8b1545f530cf1f1f77d51 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 18 Jul 2007 14:54:27 +0000 Subject: [PATCH] Added call to State::initializeExtensionsProcs() to prevent crashes before these variables are initialized. --- src/osg/GraphicsContext.cpp | 8 ++++++++ src/osg/GraphicsThread.cpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index cd3dc1e32..c31643783 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -431,6 +431,10 @@ bool GraphicsContext::makeCurrent() if (result) { _threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread(); + + // initialize extension proces, not only initializes on first + // call, will be a non-op on subsequent calls. + getState()->initializeExtensionProcs(); } return result; @@ -443,6 +447,10 @@ bool GraphicsContext::makeContextCurrent(GraphicsContext* readContext) if (result) { _threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread(); + + // initialize extension proces, not only initializes on first + // call, will be a non-op on subsequent calls. + getState()->initializeExtensionProcs(); } return result; diff --git a/src/osg/GraphicsThread.cpp b/src/osg/GraphicsThread.cpp index 581f340b7..825b1e248 100644 --- a/src/osg/GraphicsThread.cpp +++ b/src/osg/GraphicsThread.cpp @@ -30,6 +30,8 @@ void GraphicsThread::run() if (graphicsContext) { graphicsContext->makeCurrent(); + + graphicsContext->getState()->initializeExtensionProcs(); } OperationThread::run();