diff options
author | Max Horn | 2008-12-26 00:43:52 +0000 |
---|---|---|
committer | Max Horn | 2008-12-26 00:43:52 +0000 |
commit | c9105aa58f3b0a210c32aa51e0c1ff4ebe896241 (patch) | |
tree | c7c851e8c30590515603128fac0c77d9be52e1ad /gui | |
parent | c3aec16033ffe04edabff427b64db405a7de797e (diff) | |
download | scummvm-rg350-c9105aa58f3b0a210c32aa51e0c1ff4ebe896241.tar.gz scummvm-rg350-c9105aa58f3b0a210c32aa51e0c1ff4ebe896241.tar.bz2 scummvm-rg350-c9105aa58f3b0a210c32aa51e0c1ff4ebe896241.zip |
Fix for bug #2210082: GUI: Crash in GMM when changing scale factor
svn-id: r35546
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeLayout.cpp | 4 | ||||
-rw-r--r-- | gui/ThemeLayout.h | 27 |
2 files changed, 21 insertions, 10 deletions
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp index 2a09d87467..821eed472d 100644 --- a/gui/ThemeLayout.cpp +++ b/gui/ThemeLayout.cpp @@ -48,9 +48,9 @@ void ThemeLayout::importLayout(ThemeLayout *layout) { if (getLayoutType() == layout->getLayoutType()) { for (uint i = 0; i < layout->_children.size(); ++i) - _children.push_back(layout->_children[i]->makeClone()); + _children.push_back(layout->_children[i]->makeClone(this)); } else { - _children.push_back(layout->makeClone()); + _children.push_back(layout->makeClone(this)); } } diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h index 5b1d69540b..ce7131ec29 100644 --- a/gui/ThemeLayout.h +++ b/gui/ThemeLayout.h @@ -40,6 +40,7 @@ class ThemeLayout { friend class ThemeLayoutVertical; friend class ThemeLayoutHorizontal; friend class ThemeLayoutSpacing; + friend class ThemeLayoutWidget; public: enum LayoutType { kLayoutMain, @@ -98,7 +99,7 @@ protected: virtual LayoutType getLayoutType() = 0; - virtual ThemeLayout *makeClone() = 0; + virtual ThemeLayout *makeClone(ThemeLayout *newParent) = 0; public: virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, uint16 &w, uint16 &h); @@ -149,7 +150,7 @@ public: #endif LayoutType getLayoutType() { return kLayoutMain; } - ThemeLayout *makeClone() { assert(!"Do not copy Main Layouts!"); return 0; } + ThemeLayout *makeClone(ThemeLayout *newParent) { assert(!"Do not copy Main Layouts!"); return 0; } protected: int16 _defaultX; @@ -171,11 +172,12 @@ public: LayoutType getLayoutType() { return kLayoutVertical; } - ThemeLayout *makeClone() { + ThemeLayout *makeClone(ThemeLayout *newParent) { ThemeLayoutVertical *n = new ThemeLayoutVertical(*this); + n->_parent = newParent; for (uint i = 0; i < n->_children.size(); ++i) - n->_children[i] = n->_children[i]->makeClone(); + n->_children[i] = n->_children[i]->makeClone(n); return n; } @@ -195,11 +197,12 @@ public: #endif LayoutType getLayoutType() { return kLayoutHorizontal; } - ThemeLayout *makeClone() { + ThemeLayout *makeClone(ThemeLayout *newParent) { ThemeLayoutHorizontal *n = new ThemeLayoutHorizontal(*this); + n->_parent = newParent; for (uint i = 0; i < n->_children.size(); ++ i) - n->_children[i] = n->_children[i]->makeClone(); + n->_children[i] = n->_children[i]->makeClone(n); return n; } @@ -219,7 +222,11 @@ public: #endif LayoutType getLayoutType() { return kLayoutWidget; } - ThemeLayout *makeClone() { return new ThemeLayoutWidget(*this); } + ThemeLayout *makeClone(ThemeLayout *newParent) { + ThemeLayout *n = new ThemeLayoutWidget(*this); + n->_parent = newParent; + return n; + } protected: Common::String _name; @@ -244,7 +251,11 @@ public: const char *getName() const { return "SPACE"; } #endif - ThemeLayout *makeClone() { return new ThemeLayoutSpacing(*this); } + ThemeLayout *makeClone(ThemeLayout *newParent) { + ThemeLayout *n = new ThemeLayoutSpacing(*this); + n->_parent = newParent; + return n; + } }; } |