Hot Door CORE Forum
timer crash on quit - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Bugs (http://hotdoorcore.com/forum/forumdisplay.php?fid=5)
+--- Thread: timer crash on quit (/showthread.php?tid=341)



timer crash on quit - Rick Johnson - 03-19-2023

Maybe I'm just not using timers right, but I can duplicate the crash on quit with a copy of the Panel Sample project.

Change the timer to be a class member. In panelPlugin.h add these lines:

Code:
#include "hdicoreTimer.h"
hdi::core::Timer docSavedTimer;

in panelPlugin.cpp::startup change the code to create the timer like this:


Code:
this->docSavedTimer = hdi::core::Timer(
"HDIPanelSampleDocSavedTimer",
1.0, // Delay of 1 second
HDI_CORE_CALLBACK(panel::Plugin, this, __updateSaveTimeCB)
);
this->__corePlug->dispatcher()->registerTimer(docSavedTimer);

In panelPlugin.cpp::shutdown() add this:


Code:
HDI_CORE_PLUGIN->dispatcher()->unregisterTimer(this->docSavedTimer);
this->docSavedTimer.destroy();

When run in debug mode in Xcode (AI 27, Xcode 14.2, macOS 13.1), it stops in aip::hdi::Dispatcher::timer: with Thread 1: EXC_BAD_ACCESS (code-EXC_I386_GPFLT). If I deactivate the timer first, it still crashes.

It crashes under Windows 10, too, AI 23 and 27 tested. In VS 2015 I cannot see the breakpoint, just end with an error that the ntdll.pdb is not loaded and I can no longer retrieve it from Microsoft Symbol Servers.

Is this a bug, or am I just not shutting down correctly?