From e153ea49f7442a82651e4e35f2be59c459ad32cb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Oct 2013 01:36:40 +0300 Subject: Use all parameters in browserbox constructors. Also load browserbox skin for each instance. --- src/gui/widgets/browserbox.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gui/widgets/browserbox.cpp') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 6fd38e4c6..c8edf757b 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -44,7 +44,6 @@ #include "debug.h" -Skin *BrowserBox::mSkin = nullptr; ImageSet *BrowserBox::mEmotes = nullptr; int BrowserBox::mInstances = 0; @@ -58,6 +57,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mLineParts(), mLinks(), mLinkHandler(nullptr), + mSkin(nullptr), mMode(mode), mHighMode(UNDERLINE | BACKGROUND), mSelectedLink(-1), @@ -84,10 +84,11 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mBackgroundColor = getThemeColor(Theme::BACKGROUND); + Theme *const theme = Theme::instance(); + if (theme) + mSkin = theme->load("browserbox.xml", ""); if (mInstances == 0) { - if (Theme::instance()) - mSkin = Theme::instance()->load("browserbox.xml", ""); mEmotes = ResourceManager::getInstance()->getImageSet( "graphics/sprites/chatemotes.png", 17, 18); } @@ -130,11 +131,16 @@ BrowserBox::~BrowserBox() if (gui) gui->removeDragged(this); + Theme *const theme = Theme::instance(); + if (theme) + { + theme->unload(mSkin); + mSkin = nullptr; + } + mInstances --; if (mInstances == 0) { - if (Theme::instance()) - Theme::instance()->unload(mSkin); if (mEmotes) { mEmotes->decRef(); -- cgit v1.2.3-60-g2f50