[gnome-documents/gnome-3-22] application: Assert that the ShellSearchProvider's lifetime is sane



commit 8d13a5f0a8937a74bc85a7f1df7f8d6bcdfad32e
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 8 16:12:34 2017 +0200

    application: Assert that the ShellSearchProvider's lifetime is sane
    
    The ShellSearchProvider should be instantiated in the dbus_register
    virtual method, which is expected to be called only once.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783548

 src/application.js |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 2630e19..1e43981 100644
--- a/src/application.js
+++ b/src/application.js
@@ -513,6 +513,9 @@ const Application = new Lang.Class({
     vfunc_dbus_register: function(connection, path) {
         this.parent(connection, path);
 
+        if (this._searchProvider != null)
+            throw(new Error('ShellSearchProvider already instantiated - dbus_register called twice?'));
+
         this._searchProvider = new ShellSearchProvider.ShellSearchProvider();
         this._searchProvider.connect('activate-result', Lang.bind(this, this._onActivateResult));
         this._searchProvider.connect('launch-search', Lang.bind(this, this._onLaunchSearch));


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