Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Moved some of the disposing code around to fix that hang-on-exit bug.
Browse files Browse the repository at this point in the history
svn path=/trunk/debugger/; revision=23735
  • Loading branch information
Martin Baulig committed Mar 5, 2004
1 parent ceea5f7 commit 05f854e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions backends/Debugger.cs
Expand Up @@ -269,14 +269,14 @@ protected virtual void Dispose (bool disposing)

// If this is a call to Dispose, dispose all managed resources.
if (disposing) {
if (thread_manager != null) {
thread_manager.Dispose ();
thread_manager = null;
}
if (symtab_manager != null) {
symtab_manager.Dispose ();
symtab_manager = null;
}
if (thread_manager != null) {
thread_manager.Dispose ();
thread_manager = null;
}
if (bfd_container != null) {
bfd_container.Dispose ();
bfd_container = null;
Expand Down
5 changes: 4 additions & 1 deletion backends/Process.cs
Expand Up @@ -772,7 +772,10 @@ protected void check_disposed ()

protected virtual void DoDispose ()
{
engine.Dispose ();
if (engine != null) {
engine.Dispose ();
engine = null;
}
}

protected virtual void Dispose (bool disposing)
Expand Down
9 changes: 2 additions & 7 deletions backends/SingleSteppingEngine.cs
Expand Up @@ -1861,19 +1861,14 @@ private void check_disposed ()
protected virtual void Dispose (bool disposing)
{
// Check to see if Dispose has already been called.
lock (this) {
if (disposed)
return;

disposed = true;
}

// If this is a call to Dispose, dispose all managed resources.
if (disposing) {
if (inferior != null)
inferior.Kill ();
inferior = null;
}

disposed = true;
}

public void Dispose ()
Expand Down
5 changes: 4 additions & 1 deletion backends/ThreadManager.cs
Expand Up @@ -139,9 +139,11 @@ public void StartApplication (ProcessStart start)
this.start = start;

wait_thread = new Thread (new ThreadStart (start_wait_thread));
wait_thread.IsBackground = true;
wait_thread.Start ();

inferior_thread = new Thread (new ThreadStart (start_inferior));
inferior_thread.IsBackground = true;
inferior_thread.Start ();
}

Expand Down Expand Up @@ -668,7 +670,8 @@ protected virtual void DoDispose ()
thread_hash.Values.CopyTo (threads, 0);

for (int i = 0; i < threads.Length; i++)
threads [i].Kill ();
threads [i].Dispose ();
main_process.Dispose ();
}

private bool disposed = false;
Expand Down
1 change: 1 addition & 0 deletions classes/SymbolTableManager.cs
Expand Up @@ -26,6 +26,7 @@ public SymbolTableManager ()
modules_loaded_event = new ManualResetEvent (true);
update_completed_event = new ManualResetEvent (true);
symtab_thread = new Thread (new ThreadStart (symtab_thread_start));
symtab_thread.IsBackground = true;
symtab_thread.Start ();
}

Expand Down

0 comments on commit 05f854e

Please sign in to comment.