[Scummvm-cvs-logs] SF.net SVN: scummvm:[40327] scummvm/trunk/engines/sci/gfx

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue May 5 14:33:11 CEST 2009


Revision: 40327
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40327&view=rev
Author:   fingolfin
Date:     2009-05-05 12:33:11 +0000 (Tue, 05 May 2009)

Log Message:
-----------
SCI: Work around an 'Array used after being disposed' bug that occurs when a GfxVisual gets disposed

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/gfx_state_internal.h
    scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp

Modified: scummvm/trunk/engines/sci/gfx/gfx_state_internal.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_state_internal.h	2009-05-05 12:29:15 UTC (rev 40326)
+++ scummvm/trunk/engines/sci/gfx/gfx_state_internal.h	2009-05-05 12:33:11 UTC (rev 40327)
@@ -340,6 +340,7 @@
 
 public:
 	GfxVisual(GfxState *state, int font);
+	~GfxVisual();
 
 	virtual int draw(const Common::Point &pos);
 	virtual void print(int indentation) const;

Modified: scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp	2009-05-05 12:29:15 UTC (rev 40326)
+++ scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp	2009-05-05 12:33:11 UTC (rev 40327)
@@ -1461,6 +1461,21 @@
 	_gfxw_set_ops_VISUAL(this);
 }
 
+GfxVisual::~GfxVisual() {
+	// HACK: We must dispose all content *here* already, because our child widgets
+	// still may have references to this object, and will try to invoke methods
+	// of this object which try to access the already cleared _portRefs array
+	// when they are destroyed.
+	GfxWidget *seeker = _contents;
+
+	while (seeker) {
+		GfxWidget *next = seeker->_next;
+		delete seeker;
+		seeker = next;
+	}
+	_contents = 0;
+}
+
 static int _visual_find_free_ID(GfxVisual *visual) {
 	uint id = 0;
 


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