diff options
| author | j-p <jp.bruyere@live.be> | 2017-08-28 05:12:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-28 05:12:19 +0200 |
| commit | 7c43799ca7dd753b40ef22a24e0bc8fd24c92adc (patch) | |
| tree | 859591fe2b4cd3a8011f9cc14f000490c28007dc /src/CrowThread.cs | |
| parent | 6cbe9f9d2a604cdbb74f46f3710ea3dc60a87e55 (diff) | |
full IDisposable implementation (#34)
* full implementation of IDisposable, not stable, lock and still leaking
* override dispose in popper to handle _content not yet in graphic tree (when never shown), test focusedWidget when disposing
* prevent canceling thread multiple times causing a deadlock
* test parent type when trying to close window
Diffstat (limited to 'src/CrowThread.cs')
| -rw-r--r-- | src/CrowThread.cs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/CrowThread.cs b/src/CrowThread.cs index fbcdc956..823fe1a6 100644 --- a/src/CrowThread.cs +++ b/src/CrowThread.cs @@ -33,7 +33,7 @@ namespace Crow /// Thread monitored by current interface with Finished event when state==Stopped /// </summary> public class CrowThread { - public bool cancel = false; + public bool cancelRequested = false; Thread thread; public event EventHandler Finished; public GraphicObject Host; @@ -53,11 +53,9 @@ namespace Crow } public void Start() { thread.Start();} public void Cancel(){ - if (thread.IsAlive){ - cancel = true; - //cancelLoading = true; + if (thread.IsAlive & !cancelRequested){ + cancelRequested = true; thread.Join (); - //cancelLoading = false; } lock (Host.currentInterface.CrowThreads) Host.currentInterface.CrowThreads.Remove (this); |