raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=c0ee372ba1469ecd48949cfed3c9642ba00cfd1f

commit c0ee372ba1469ecd48949cfed3c9642ba00cfd1f
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Tue Apr 14 19:30:02 2020 +0100

    e dnd - add timeout in case we don't get a finished from the other end
    
    2 second timeout seems reasonable. could be less... but should avoid
    hangs.
---
 src/bin/e_dnd.c | 17 +++++++++++++++++
 src/bin/e_dnd.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index c6253188e..dc78157ab 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -985,6 +985,17 @@ _e_drag_update(Ecore_Window root, int x, int y, unsigned 
int action)
 //   printf("DND UPDATE %3.7f\n", t2); ////
 }
 
+static Eina_Bool
+_drag_timeout(void *data)
+{
+   E_Drag *drag = data;
+
+   drag->timeout = NULL;
+   ERR("Drop finished response timeout...");
+   e_object_del(E_OBJECT(drag));
+   return EINA_FALSE;
+}
+
 static void
 _e_drag_end(int x, int y)
 {
@@ -1025,6 +1036,7 @@ _e_drag_end(int x, int y)
           _drag_current->cb.finished(_drag_current, dropped);
         _drag_current->cb.finished = NULL;
         _drag_current->ended = 1;
+        _drag_current->timeout = ecore_timer_add(2.0, _drag_timeout, 
_drag_current);
         return;
      }
 
@@ -1141,6 +1153,11 @@ _e_drag_free(E_Drag *drag)
 {
    unsigned int i;
 
+   if (drag->timeout)
+     {
+        ecore_timer_del(drag->timeout);
+        drag->timeout = NULL;
+     }
    if (drag == _drag_current)
      {
         E_Event_Dnd_Leave leave_ev;
diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h
index 3456830d3..e36fb2571 100644
--- a/src/bin/e_dnd.h
+++ b/src/bin/e_dnd.h
@@ -41,6 +41,7 @@ struct _E_Drag
    Evas              *evas;
    Evas_Object       *comp_object;
    Evas_Object       *object;
+   Ecore_Timer       *timeout;
 
    int                x, y, w, h;
    int                dx, dy;

-- 


Reply via email to