diff --git a/src/Contexts/AbstractXWindowContext.cpp b/src/Contexts/AbstractXWindowContext.cpp index 061111f5d..b0087b4ad 100644 --- a/src/Contexts/AbstractXWindowContext.cpp +++ b/src/Contexts/AbstractXWindowContext.cpp @@ -15,6 +15,7 @@ #include "AbstractXWindowContext.h" +#include "Context.h" #include "ExtensionWrangler.h" #define None 0L // redef Xlib nonsense @@ -70,9 +71,13 @@ AbstractXWindowContext::AbstractXWindowContext(AbstractContextexperimentalExtensionWranglerFeatures()); + + c = new Context; } AbstractXWindowContext::~AbstractXWindowContext() { + delete c; + /* Shut down the interface */ delete glInterface; diff --git a/src/Contexts/AbstractXWindowContext.h b/src/Contexts/AbstractXWindowContext.h index c94eb34bd..6415cacfd 100644 --- a/src/Contexts/AbstractXWindowContext.h +++ b/src/Contexts/AbstractXWindowContext.h @@ -33,7 +33,11 @@ #include "AbstractWindowContext.h" #include "AbstractContext.h" -namespace Magnum { namespace Contexts { +namespace Magnum { + +class Context; + +namespace Contexts { /** @nosubgrouping @brief Base for X11-based contexts @@ -279,6 +283,8 @@ class AbstractXWindowContext: public AbstractWindowContext { AbstractContext* glInterface; + Context* c; + /** @todo Get this from the created window */ Math::Vector2 viewportSize; diff --git a/src/Contexts/EglContext.cpp b/src/Contexts/EglContext.cpp index 96cb8dd4d..fe9d7975d 100644 --- a/src/Contexts/EglContext.cpp +++ b/src/Contexts/EglContext.cpp @@ -20,8 +20,6 @@ namespace Magnum { namespace Contexts { EglContext::~EglContext() { - delete c; - eglDestroyContext(display, context); eglDestroySurface(display, surface); eglTerminate(display); @@ -85,8 +83,6 @@ void EglContext::createContext(EGLNativeWindowType window) { } /** @bug Fixme: On desktop OpenGL and Mesa EGL implementation OpenGL version is 1.0, which is wrong */ - - context = new Context; } }} diff --git a/src/Contexts/EglContext.h b/src/Contexts/EglContext.h index f0e657690..0190fa299 100644 --- a/src/Contexts/EglContext.h +++ b/src/Contexts/EglContext.h @@ -28,11 +28,7 @@ #include "AbstractContext.h" -namespace Magnum { - -class Context; - -namespace Contexts { +namespace Magnum { namespace Contexts { #ifndef DOXYGEN_GENERATING_OUTPUT /* EGL returns visual ID as int, but Xorg expects long unsigned int */ @@ -68,8 +64,6 @@ class EglContext: public AbstractContext { Window window; GLXFBConfig* configs; GLXContext context; - - Context* c; }; }}