[gimp/gimp-2-10] Issue #4895 - Crash when dragging a dockable dialog



commit 64603c2ce62a01d21fb02a04716c6d5a26b6560a
Author: Ell <ell_se yahoo com>
Date:   Fri Apr 3 19:59:19 2020 +0300

    Issue #4895 - Crash when dragging a dockable dialog
    
    Apparently, the "drag-begin" signal of dockbook tabs can be raised
    multiple times when a drag begins (this seems to happen randomly,
    and rarely -- possibly a GTK bug).  In
    gimp_paned_box_drag_callback(), which gets called in response, make
    sure not to leak the corresponding idle source in this case, which
    can lead to a segfault if the widget is destroyed before the idle
    is run.
    
    (cherry picked from commit 6bae5d8cf7f8bcca648c746fef9234f91ccc4712)

 app/widgets/gimppanedbox.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimppanedbox.c b/app/widgets/gimppanedbox.c
index bffda023e5..ba04b9a1cf 100644
--- a/app/widgets/gimppanedbox.c
+++ b/app/widgets/gimppanedbox.c
@@ -594,7 +594,12 @@ gimp_paned_box_drag_callback (GdkDragContext *context,
   paned = gtk_widget_get_ancestor (GTK_WIDGET (paned_box),
                                    GTK_TYPE_PANED);
 
-  if (begin)
+  /* apparently, we can be called multiple times when beginning a drag
+   * (possibly a gtk bug); make sure not to leak the idle.
+   *
+   * see issue #4895.
+   */
+  if (begin && ! paned_box->p->dnd_context)
     {
       paned_box->p->dnd_context = context;
 
@@ -638,7 +643,7 @@ gimp_paned_box_drag_callback (GdkDragContext *context,
         (GSourceFunc) gimp_paned_box_drag_callback_idle,
         paned_box);
     }
-  else
+  else if (! begin && paned_box->p->dnd_context)
     {
       if (paned_box->p->dnd_idle_id)
         {


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