[gjs: 2/7] overrides/Gio: Guard against repeated _promisify() calls



commit b54b74cacbab08ea6c489a1523b823a647df2df9
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Mar 25 15:42:48 2020 +0100

    overrides/Gio: Guard against repeated _promisify() calls
    
    Calling _promisify() on a method that is already promisified will
    break it. Fix this with a simple check at the start of the function,
    and bail out if the method has been promisifed before.

 modules/core/overrides/Gio.js | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/modules/core/overrides/Gio.js b/modules/core/overrides/Gio.js
index 0aa9f437..b354ab84 100644
--- a/modules/core/overrides/Gio.js
+++ b/modules/core/overrides/Gio.js
@@ -421,6 +421,8 @@ function* _listModelIterator() {
 }
 
 function _promisify(proto, asyncFunc, finishFunc) {
+    if (proto[`_original_${asyncFunc}`] !== undefined)
+        return;
     proto[`_original_${asyncFunc}`] = proto[asyncFunc];
     proto[asyncFunc] = function (...args) {
         if (!args.every(arg => typeof arg !== 'function'))


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