# HG changeset patch
# User Edouard Tisserant
# Date 1617025562 -7200
# Node ID a5bca0a5eaf53c7335bd5151de5e170a210a2cbb
# Parent  b5330d76e225af2156cd89ca35013d4db06a88f8
Fixed misuse of GridCellEditor in DurationCellEditor, potentially leading to crash on windows.

diff -r b5330d76e225 -r a5bca0a5eaf5 controls/DurationCellEditor.py
--- a/controls/DurationCellEditor.py	Mon Mar 29 14:35:45 2021 +0200
+++ b/controls/DurationCellEditor.py	Mon Mar 29 15:46:02 2021 +0200
@@ -122,21 +122,18 @@
         self.CellControl.SetValue(self.Table.GetValueByName(row, self.Colname))
         self.CellControl.SetFocus()
 
-    def EndEditInternal(self, row, col, grid, old_duration):
-        duration = self.CellControl.GetValue()
-        changed = duration != old_duration
+    def EndEdit(self, row, col, grid, oldval):
+        value = self.CellControl.GetValue()
+        changed = value != oldval
         if changed:
-            self.Table.SetValueByName(row, self.Colname, duration)
+            return value
+        else:
+            return None
+
+    def ApplyEdit(self, row, col, grid):
+        value = self.CellControl.GetValue()
+        self.Table.SetValueByName(row, self.Colname, value)
         self.CellControl.Disable()
-        return changed
-
-    if wx.VERSION >= (3, 0, 0):
-        def EndEdit(self, row, col, grid, oldval):
-            return self.EndEditInternal(row, col, grid, oldval)
-    else:
-        def EndEdit(self, row, col, grid):
-            oldval = self.Table.GetValueByName(row, self.Colname)
-            return self.EndEditInternal(row, col, grid, oldval)
 
     def SetSize(self, rect):
         self.CellControl.SetDimensions(rect.x + 1, rect.y,