summaryrefslogtreecommitdiff
path: root/src/gui/widgets/scrollarea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/scrollarea.cpp')
-rw-r--r--src/gui/widgets/scrollarea.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 98b58f51c..c21ddd17c 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -102,9 +102,9 @@ ScrollArea::~ScrollArea()
const Theme *const theme = Theme::instance();
if (theme)
{
- theme->unloadRect(background);
if (instances == 0)
{
+ theme->unloadRect(background);
theme->unloadRect(vMarker);
theme->unloadRect(vMarkerHi);
theme->unloadRect(vBackground);
@@ -135,12 +135,6 @@ void ScrollArea::init(std::string skinName)
setLeftButtonScrollAmount(2);
setRightButtonScrollAmount(2);
- if (skinName == "")
- skinName = "scroll_background.xml";
- Theme *const theme = Theme::instance();
- if (theme)
- theme->loadRect(background, skinName, "scroll_background.xml");
-
if (instances == 0)
{
for (int f = 0; f < 9; f ++)
@@ -152,6 +146,13 @@ void ScrollArea::init(std::string skinName)
hBackground.grid[f] = nullptr;
}
+ // +++ here probably need move background from static
+ if (skinName == "")
+ skinName = "scroll_background.xml";
+ Theme *const theme = Theme::instance();
+ if (theme)
+ theme->loadRect(background, skinName, "scroll_background.xml");
+
if (theme)
{
theme->loadRect(vMarker, "scroll.xml", "");
@@ -169,7 +170,8 @@ void ScrollArea::init(std::string skinName)
const ImageRect &rect = skin->getBorder();
for (int f = UP; f < BUTTONS_DIR; f ++)
{
- rect.grid[f]->incRef();
+ if (rect.grid[f])
+ rect.grid[f]->incRef();
buttons[f][i] = rect.grid[f];
}
if (i == 0)
@@ -188,7 +190,6 @@ void ScrollArea::init(std::string skinName)
}
}
mScrollbarWidth = mScrollbarSize;
-
instances++;
}