[gnome-shell] appDisplay: Check instanceof AppIcon using constructor inside the class



commit 5687035c9b6f0c1d192fb88e2892f68ec7451515
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Tue Oct 29 23:47:55 2019 +0100

    appDisplay: Check instanceof AppIcon using constructor inside the class
    
    It seems like some recent change (maybe the move to a ClutterActor
    subclass for AppIcon) broke the check whether the drag source is an
    instance of AppIcon. While the drag source indeed is an AppIcon and
    everything else works correctly, the check still returns false, which
    breaks the creation of new folders using DnD.
    
    Theoretically it makes sense that this doesn't work, because we're
    assigning AppIcon using `var AppIcon =` and that will only get set after
    `GObject.register_class()` finished, so accessing `AppIcon` inside that
    function seems risky and is probably wrong.
    
    Fix this by comparing to `this.constructor` instead of `AppIcon`, which
    works fine and we know for sure exists at this point.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/794

 js/ui/appDisplay.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 6ff6be735e..ee0beabe97 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -2372,7 +2372,7 @@ var AppIcon = GObject.registerClass({
         let view = _getViewFromIcon(source);
 
         return source != this &&
-               (source instanceof AppIcon) &&
+               (source instanceof this.constructor) &&
                (view instanceof AllView);
     }
 


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