diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gfx/gfx_state_internal.h | 1 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_widgets.cpp | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/engines/sci/gfx/gfx_state_internal.h b/engines/sci/gfx/gfx_state_internal.h index f6085b4a0e..8b1c443e86 100644 --- a/engines/sci/gfx/gfx_state_internal.h +++ b/engines/sci/gfx/gfx_state_internal.h @@ -340,6 +340,7 @@ struct GfxVisual : public GfxContainer { public: GfxVisual(GfxState *state, int font); + ~GfxVisual(); virtual int draw(const Common::Point &pos); virtual void print(int indentation) const; 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; |