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



commit 961d1ffcdaf06a0e7aaabdfc8332d13fe5da27b8
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 c9b7132..02dc1be 100644
--- a/src/application.js
+++ b/src/application.js
@@ -441,6 +441,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]