[gitg] Do not join thread in destructor



commit 0137e13f256aabd733ea9035a072085e183672f2
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Jan 3 19:36:30 2014 +0100

    Do not join thread in destructor

 libgitg/gitg-stage-status-enumerator.vala |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/libgitg/gitg-stage-status-enumerator.vala b/libgitg/gitg-stage-status-enumerator.vala
index b6251d9..b767330 100644
--- a/libgitg/gitg-stage-status-enumerator.vala
+++ b/libgitg/gitg-stage-status-enumerator.vala
@@ -69,7 +69,7 @@ public class StageStatusEnumerator : Object
                } catch {}
        }
 
-       ~StageStatusEnumerator()
+       public void cancel()
        {
                lock (d_files)
                {
@@ -79,7 +79,11 @@ public class StageStatusEnumerator : Object
                        }
                }
 
-               d_thread.join();
+               if (d_thread != null)
+               {
+                       d_thread.join();
+                       d_thread = null;
+               }
        }
 
        private void *run_status()
@@ -180,6 +184,11 @@ public class StageStatusEnumerator : Object
                        ret = fill_files(num);
                }
 
+               if (ret.length != num)
+               {
+                       cancel();
+               }
+
                return ret;
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]