[Scummvm-cvs-logs] SF.net SVN: scummvm:[35546] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Dec 26 01:43:52 CET 2008


Revision: 35546
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35546&view=rev
Author:   fingolfin
Date:     2008-12-26 00:43:52 +0000 (Fri, 26 Dec 2008)

Log Message:
-----------
Fix for bug #2210082: GUI: Crash in GMM when changing scale factor

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeLayout.cpp
    scummvm/trunk/gui/ThemeLayout.h

Modified: scummvm/trunk/gui/ThemeLayout.cpp
===================================================================
--- scummvm/trunk/gui/ThemeLayout.cpp	2008-12-26 00:26:34 UTC (rev 35545)
+++ scummvm/trunk/gui/ThemeLayout.cpp	2008-12-26 00:43:52 UTC (rev 35546)
@@ -48,9 +48,9 @@
 
 	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));
 	}
 }
 

Modified: scummvm/trunk/gui/ThemeLayout.h
===================================================================
--- scummvm/trunk/gui/ThemeLayout.h	2008-12-26 00:26:34 UTC (rev 35545)
+++ scummvm/trunk/gui/ThemeLayout.h	2008-12-26 00:43:52 UTC (rev 35546)
@@ -40,6 +40,7 @@
 	friend class ThemeLayoutVertical;
 	friend class ThemeLayoutHorizontal;
 	friend class ThemeLayoutSpacing;
+	friend class ThemeLayoutWidget;
 public:
 	enum LayoutType {
 		kLayoutMain,
@@ -98,7 +99,7 @@
 
 	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 @@
 #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 @@
 	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 @@
 #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 @@
 #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 @@
 	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;
+	}
 };
 
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list