diff options
author | Max Horn | 2009-05-05 12:33:11 +0000 |
---|---|---|
committer | Max Horn | 2009-05-05 12:33:11 +0000 |
commit | dc29c404a755dd9583a35d129d73c2b904b43031 (patch) | |
tree | 2bbf2e56f9acf0da6f0b785021b482da8af5afc0 /engines/sci/gfx/gfx_widgets.cpp | |
parent | 61dcaad8886c9e1ced630eeab364f59cd27a4657 (diff) | |
download | scummvm-rg350-dc29c404a755dd9583a35d129d73c2b904b43031.tar.gz scummvm-rg350-dc29c404a755dd9583a35d129d73c2b904b43031.tar.bz2 scummvm-rg350-dc29c404a755dd9583a35d129d73c2b904b43031.zip |
SCI: Work around an 'Array used after being disposed' bug that occurs when a GfxVisual gets disposed
svn-id: r40327
Diffstat (limited to 'engines/sci/gfx/gfx_widgets.cpp')
-rw-r--r-- | engines/sci/gfx/gfx_widgets.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp index a90458118c..71ff4d82ff 100644 --- a/engines/sci/gfx/gfx_widgets.cpp +++ b/engines/sci/gfx/gfx_widgets.cpp @@ -1461,6 +1461,21 @@ GfxVisual::GfxVisual(GfxState *state, int font) _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; |