[chronojump] Closing Chronojump (delete event) while contacts capture now cancels capture
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Closing Chronojump (delete event) while contacts capture now cancels capture
- Date: Tue, 25 Jun 2019 12:14:51 +0000 (UTC)
commit e327e7be7186c78d06bf849580fc70b5cc7cd594
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jun 25 14:14:17 2019 +0200
Closing Chronojump (delete event) while contacts capture now cancels capture
src/execute/event.cs | 8 ++++++++
src/gui/chronojump.cs | 11 +++++++++++
2 files changed, 19 insertions(+)
---
diff --git a/src/execute/event.cs b/src/execute/event.cs
index 4d2c700a..cf988008 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -245,6 +245,14 @@ public class EventExecute
return true;
}
+ //used on Chronojump exit (if user wants to close program while it is capturing
+ public bool IsThreadRunning() {
+ if (thread != null && thread.IsAlive)
+ return true;
+
+ return false;
+ }
+
public void ThreadAbort() {
thread.Abort();
}
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 91bbbf97..22425c30 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2196,6 +2196,17 @@ public partial class ChronoJumpWindow
updatingRestTimes = false;
+ //close contacts capture
+ if(currentEventExecute != null && currentEventExecute.IsThreadRunning())
+ {
+ LogB.Information("Closing contacts capture thread...");
+ currentEventExecute.Cancel = true;
+ LogB.Information("Done!");
+
+ //do not need this, above cancelling is enough
+ //currentEventExecute.ThreadAbort();
+ }
+
if(threadRFID != null && threadRFID.IsAlive)
{
LogB.Information("Closing threadRFID");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]