[polari/gnome-3-34] pasteManager: Catch newly-added gjs exception



commit 13578c7ef0c873a3ee1689da93d9090aba31d542
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Nov 25 17:48:08 2019 +0100

    pasteManager: Catch newly-added gjs exception
    
    gjs 1.58.2 started throwing an exception when encountering a parameter that
    is an array of plain structs, as that case is not currently supported.
    
    The exception is overly broad though, and also broke the one case that is
    supported: An empty array where the actually struct type isn't relevant.
    
    We cannot fix this in Polari, but at least we can catch the exception to
    fail gracefully, so only DND drop target support gets broken instead of
    the whole interface.
    
    https://gitlab.gnome.org/GNOME/polari/issues/114

 src/pasteManager.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/pasteManager.js b/src/pasteManager.js
index dd2493d..7e39f24 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -87,7 +87,15 @@ var DropTargetIface = GObject.registerClass({
     addTargets(widget) {
         this._dragHighlight = false;
 
-        widget.drag_dest_set(0, [], Gdk.DragAction.COPY);
+        // Broken in gjs 1.58.2
+        try {
+            widget.drag_dest_set(0, [], Gdk.DragAction.COPY);
+        } catch (e) {
+            if (!DropTargetIface.__brokenWarning)
+                log('Failed to set up DND drop target.');
+            DropTargetIface.__brokenWarning = true;
+            return;
+        }
 
         let targetList = widget.drag_dest_get_target_list();
         if (!targetList)


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