diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-10-05 21:45:27 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-10-05 21:45:27 +0000 |
commit | 4a43cb1c6e5ba304d70df7066c61c52718a5f249 (patch) | |
tree | d8aca0414b771cb2b7532d6f4f9d2ed87f77d703 /src/gui/button.cpp | |
parent | 8415f7791ea8dc84148c65d04c288d8d12eb50bf (diff) | |
download | mana-4a43cb1c6e5ba304d70df7066c61c52718a5f249.tar.gz mana-4a43cb1c6e5ba304d70df7066c61c52718a5f249.tar.bz2 mana-4a43cb1c6e5ba304d70df7066c61c52718a5f249.tar.xz mana-4a43cb1c6e5ba304d70df7066c61c52718a5f249.zip |
Fixed some resource cleanup and memory leaks. Also changed the way dangling
references to resources are reported to be more informative.
Diffstat (limited to 'src/gui/button.cpp')
-rw-r--r-- | src/gui/button.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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*>(graphics)->drawImageRect(0, 0, getWidth(), getHeight(), - button[mode]); + dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, + getWidth(), getHeight(), + button[mode]); graphics->setColor(getForegroundColor()); |