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



commit 23c901a00c7086c9a68e054113b0ca6ac222181c
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 ad7e052..e5a8be0 100644
--- a/src/application.js
+++ b/src/application.js
@@ -445,6 +445,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]