From 2a6c52c97b6ed66eb7d3674f6b67b45982f55c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 14 Apr 2013 14:01:01 +0200 Subject: [PATCH] Platform: fix WindowlessGlxApplication context creation and destruction. The variable wasn't initialized so it exited with assertion failure, moreover the context wasn't deleted on destruction, causing memory leak. --- src/Platform/WindowlessGlxApplication.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Platform/WindowlessGlxApplication.cpp b/src/Platform/WindowlessGlxApplication.cpp index 2d7c017b8..0108bc2ca 100644 --- a/src/Platform/WindowlessGlxApplication.cpp +++ b/src/Platform/WindowlessGlxApplication.cpp @@ -33,11 +33,11 @@ namespace Magnum { namespace Platform { -WindowlessGlxApplication::WindowlessGlxApplication(const Arguments&) { +WindowlessGlxApplication::WindowlessGlxApplication(const Arguments&): c(nullptr) { createContext(new Configuration); } -WindowlessGlxApplication::WindowlessGlxApplication(const Arguments&, Configuration* configuration) { +WindowlessGlxApplication::WindowlessGlxApplication(const Arguments&, Configuration* configuration): c(nullptr) { if(configuration) createContext(configuration); } @@ -104,6 +104,8 @@ void WindowlessGlxApplication::createContext(Configuration* configuration) { } WindowlessGlxApplication::~WindowlessGlxApplication() { + delete c; + glXMakeCurrent(display, None, nullptr); glXDestroyContext(display, context); }