File 0003-application-Assert-that-the-ShellSearchProvider-s-li.patch of Package gnome-documents.5361

From 23c901a00c7086c9a68e054113b0ca6ac222181c Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Thu, 8 Jun 2017 16:12:34 +0200
Subject: [PATCH 03/18] 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 file changed, 3 insertions(+)

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));
-- 
2.12.3

openSUSE Build Service is sponsored by