[Scummvm-tracker] [ScummVM :: Bugs] #17188: The Dig (Macintosh) crashes after R2D2 scream on Lucasarts animation logo after the ending credits

ScummVM :: Bugs trac at scummvm.org
Tue Sep 15 07:55:38 UTC 2026


#17188: The Dig (Macintosh) crashes after R2D2 scream on Lucasarts animation logo
after the ending credits
----------------------------------+----------------------------
Reporter:  filipetolhuizen        |       Owner:  (none)
    Type:  defect                 |      Status:  new
Priority:  high                   |   Component:  Engine: SCUMM
 Version:                         |  Resolution:
Keywords:  The Dig Mac Macintosh  |        Game:  The Dig
----------------------------------+----------------------------
Comment (by eriktorbjorn):

 From what I understand, this is the situation:

 - ScummEngine is derived from Engine. That means the Engine destructor
 runs after the ScummEngine destructor.
 - Once the ScummEngine destructor is finished, that object is dead.
 - When the Engine destructor triggers a callback to the ScummEngine
 instance, that's undefined behavior. It happens to work, and Valgrind
 doesn't notice. But it should not do that.
 - The callback happens through the debugger object.

 So maybe deleting the debugger early is the proper fix? Hopefully that
 will fix similar issues in other engines as well.

 {{{
 diff --git a/engines/engine.cpp b/engines/engine.cpp
 index cc7dbf5f0f0..e1a60ff1362 100644
 --- a/engines/engine.cpp
 +++ b/engines/engine.cpp
 @@ -216,13 +216,17 @@ Engine::Engine(OSystem *syst)
  }

  Engine::~Engine() {
 +       // Delete the debugger early. We don't want it to make any
 callbacks
 +       // into the game engine after its destructor has run.
 +       delete _debugger;
 +       _debugger = nullptr;
 +
         _mixer->stopAll();

         // Flush any pending remaining events
         Common::Event evt;
         while (g_system->getEventManager()->pollEvent(evt)) {}

 -       delete _debugger;
         delete _mainMenuDialog;
         g_engine = NULL;

 }}}

 I still wish it wouldn't show an exit confirmation dialog in these cases,
 but at the moment the same option controls both the engine's own
 confirmation dialogs (which I do want), and ScummVM's (which I could do
 without).
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/17188#comment:4>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list