Change shutdown behavior to allow graceful handle leaks.
This avoids crashing in case of any handle references left-over in GC allocated memory that gets finalized after module destructors have already been run.
This commit is contained in:
parent
38a4e4ca5f
commit
e2e8bf30aa
7 changed files with 96 additions and 13 deletions
|
@ -74,9 +74,14 @@ final class WinAPIEventDriver : EventDriver {
|
|||
override @property inout(WinAPIEventDriverSignals) signals() inout { return m_signals; }
|
||||
override @property inout(WinAPIEventDriverWatchers) watchers() inout { return m_watchers; }
|
||||
|
||||
override void dispose()
|
||||
override bool dispose()
|
||||
{
|
||||
if (!m_events) return;
|
||||
if (!m_events) return true;
|
||||
|
||||
if (m_core.checkForLeakedHandles()) return false;
|
||||
if (m_events.checkForLeakedHandles()) return false;
|
||||
if (m_sockets.checkForLeakedHandles()) return false;
|
||||
|
||||
m_events.dispose();
|
||||
m_core.dispose();
|
||||
assert(threadInstance !is null);
|
||||
|
@ -93,5 +98,7 @@ final class WinAPIEventDriver : EventDriver {
|
|||
freeT(m_signals);
|
||||
} ();
|
||||
catch (Exception e) assert(false, e.msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue