From 4a43cb1c6e5ba304d70df7066c61c52718a5f249 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 5 Oct 2005 21:45:27 +0000 Subject: Fixed some resource cleanup and memory leaks. Also changed the way dangling references to resources are reported to be more informative. --- src/gui/button.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/gui/button.cpp') diff --git a/src/gui/button.cpp b/src/gui/button.cpp index b2468036..bf2ca6c6 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -35,14 +35,14 @@ #include "../resources/resourcemanager.h" ImageRect Button::button[4]; -int Button::instances = 0; +int Button::mInstances = 0; Button::Button(const std::string& caption): gcn::Button(caption) { setBorderSize(0); - if (instances == 0) + if (mInstances == 0) { // Load the skin ResourceManager *resman = ResourceManager::getInstance(); @@ -71,14 +71,14 @@ Button::Button(const std::string& caption): } } - instances++; + mInstances++; } Button::~Button() { - instances--; + mInstances--; - if (instances == 0) + if (mInstances == 0) { int a, x, y, mode; @@ -112,8 +112,9 @@ void Button::draw(gcn::Graphics* graphics) mode = 0; } - dynamic_cast(graphics)->drawImageRect(0, 0, getWidth(), getHeight(), - button[mode]); + dynamic_cast(graphics)->drawImageRect(0, 0, + getWidth(), getHeight(), + button[mode]); graphics->setColor(getForegroundColor()); -- cgit v1.2.3-70-g09d2