From 789eb8e47b768f45421d16d3e56939f0f835813a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 17 Jan 2015 15:30:17 +0100 Subject: [PATCH] Platform: WindowlessWglApplication cleanup. Using std::unique_ptr instead of raw pointer, consistent private variable naming. --- src/Magnum/Platform/WindowlessWglApplication.cpp | 9 ++++----- src/Magnum/Platform/WindowlessWglApplication.h | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Magnum/Platform/WindowlessWglApplication.cpp b/src/Magnum/Platform/WindowlessWglApplication.cpp index f29da3700..b36649206 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.cpp +++ b/src/Magnum/Platform/WindowlessWglApplication.cpp @@ -25,7 +25,6 @@ #include "WindowlessWglApplication.h" -#include #include #include @@ -64,7 +63,7 @@ WindowlessWglApplication::WindowlessWglApplication(const Arguments& arguments, c createContext(configuration); } -WindowlessWglApplication::WindowlessWglApplication(const Arguments& arguments, std::nullptr_t): _window(arguments.window), _c(nullptr) {} +WindowlessWglApplication::WindowlessWglApplication(const Arguments& arguments, std::nullptr_t): _window(arguments.window) {} void WindowlessWglApplication::createContext() { createContext({}); } @@ -73,7 +72,7 @@ void WindowlessWglApplication::createContext(const Configuration& configuration) } bool WindowlessWglApplication::tryCreateContext(const Configuration&) { - CORRADE_ASSERT(!_c, "Platform::WindowlessWglApplication::tryCreateContext(): context already created", false); + CORRADE_ASSERT(!_context, "Platform::WindowlessWglApplication::tryCreateContext(): context already created", false); /* Get device context */ _deviceContext = GetDC(_window); @@ -114,12 +113,12 @@ bool WindowlessWglApplication::tryCreateContext(const Configuration&) { return false; } - _c = new Platform::Context; + _context.reset(new Platform::Context); return true; } WindowlessWglApplication::~WindowlessWglApplication() { - delete _c; + _context.reset(); wglMakeCurrent(_deviceContext, nullptr); wglDeleteContext(_renderingContext); diff --git a/src/Magnum/Platform/WindowlessWglApplication.h b/src/Magnum/Platform/WindowlessWglApplication.h index a1a26fba4..6a1f22799 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.h +++ b/src/Magnum/Platform/WindowlessWglApplication.h @@ -29,6 +29,7 @@ * @brief Class @ref Magnum::Platform::WindowlessWglApplication, macro @ref MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN() */ +#include #ifndef DOXYGEN_GENERATING_OUTPUT #define WIN32_LEAN_AND_MEAN 1 #define VC_EXTRALEAN @@ -162,7 +163,7 @@ class WindowlessWglApplication { HDC _deviceContext; HGLRC _renderingContext; - Platform::Context* _c; + std::unique_ptr _context; }; /**