vcl/inc/unx/gtk/gtkinst.hxx |    2 +-
 vcl/unx/gtk3/gtkframe.cxx   |   16 +++++++++-------
 vcl/unx/gtk3/gtkinst.cxx    |    4 ++--
 3 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 86372bf5f62aea48cb3b68d30e81597a0dac9cc2
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jun 30 14:28:21 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Jun 30 21:46:02 2021 +0200

    tdf#143113 fix crash in dnd
    
    Change-Id: Ifab741494e4cc6e51ca4cd89b57c3600d80dca44
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118163
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index a293662791ae..5fb0b67b2b8f 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -176,7 +176,7 @@ public:
     gboolean signalDragDrop(GtkDropTargetAsync *context, GdkDrop *drop, double 
x, double y);
 #endif
 
-    void signalDragLeave();
+    void signalDragLeave(GtkWidget* pWidget);
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
     void signalDragDropReceived(GtkWidget* pWidget, GdkDragContext* context, 
gint x, gint y, GtkSelectionData* data, guint ttype, guint time);
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 2b133e0868e3..b3647b6a8296 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -4643,10 +4643,12 @@ GdkDragAction 
GtkInstDropTarget::signalDragMotion(GtkDropTargetAsync *context, G
 {
     if (!m_bInDrag)
     {
-        GtkWidget* pHighlightWidget = 
GTK_WIDGET(m_pFrame->getFixedContainer());
 #if !GTK_CHECK_VERSION(4,0,0)
+        GtkWidget* pHighlightWidget = m_pFrame ? 
GTK_WIDGET(m_pFrame->getFixedContainer()) : pWidget;
         gtk_drag_highlight(pHighlightWidget);
 #else
+        GtkWidget* pHighlightWidget = m_pFrame ? 
GTK_WIDGET(m_pFrame->getFixedContainer()) :
+                gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(context));
         gtk_widget_set_state_flags(pHighlightWidget, 
GTK_STATE_FLAG_DROP_ACTIVE, false);
 #endif
     }
@@ -4744,20 +4746,20 @@ GdkDragAction 
GtkInstDropTarget::signalDragMotion(GtkDropTargetAsync *context, G
 }
 
 #if GTK_CHECK_VERSION(4,0,0)
-void GtkSalFrame::signalDragLeave(GtkDropTargetAsync* /*dest*/, GdkDrop* 
/*drop*/, gpointer frame)
+void GtkSalFrame::signalDragLeave(GtkDropTargetAsync* pDest, GdkDrop* 
/*drop*/, gpointer frame)
 {
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
     if (!pThis->m_pDropTarget)
         return;
-    pThis->m_pDropTarget->signalDragLeave();
+    
pThis->m_pDropTarget->signalDragLeave(gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(pDest)));
 }
 #else
-void GtkSalFrame::signalDragLeave(GtkWidget*, GdkDragContext* /*context*/, 
guint /*time*/, gpointer frame)
+void GtkSalFrame::signalDragLeave(GtkWidget* pWidget, GdkDragContext* 
/*context*/, guint /*time*/, gpointer frame)
 {
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
     if (!pThis->m_pDropTarget)
         return;
-    pThis->m_pDropTarget->signalDragLeave();
+    pThis->m_pDropTarget->signalDragLeave(pWidget);
 }
 #endif
 
@@ -4770,11 +4772,11 @@ static gboolean lcl_deferred_dragExit(gpointer 
user_data)
     return false;
 }
 
-void GtkInstDropTarget::signalDragLeave()
+void GtkInstDropTarget::signalDragLeave(GtkWidget *pWidget)
 {
     m_bInDrag = false;
 
-    GtkWidget* pHighlightWidget = GTK_WIDGET(m_pFrame->getFixedContainer());
+    GtkWidget* pHighlightWidget = m_pFrame ? 
GTK_WIDGET(m_pFrame->getFixedContainer()) : pWidget;
 #if !GTK_CHECK_VERSION(4,0,0)
     gtk_drag_unhighlight(pHighlightWidget);
 #else
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 0a0cb24724d7..80e2fc7983a5 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3077,10 +3077,10 @@ private:
     }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
-    static void signalDragLeave(GtkWidget*, GdkDragContext*, guint /*time*/, 
gpointer widget)
+    static void signalDragLeave(GtkWidget* pWidget, GdkDragContext*, guint 
/*time*/, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
-        pThis->m_xDropTarget->signalDragLeave();
+        pThis->m_xDropTarget->signalDragLeave(pWidget);
         if (pThis->m_bDraggedOver)
         {
             pThis->m_bDraggedOver = false;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to