[gnome-builder] intelephense & gvls: Do not override 'destroy'



commit fae618cfcd5af4d9e7899946e5523004492e311b
Author: Veli Tasalı <veli tasali gmail com>
Date:   Fri Feb 25 21:50:58 2022 +0300

    intelephense & gvls: Do not override 'destroy'
    
    Using `IdeObject.do_destroy` inside the plugins
    replaces the Builder's default destroy behavior
    (`ide_object_real_destroy`), which causes an
    infinite loop when closing projects. With this
    change, both plugins connect to the _destroy_
    signal instead.
    
    This also removes `do_parent_set` of GVls plugin
    as it doesn't do anything.
    
    Finally, GVls was attempting to close the
    IdeLspClient in its destroy method, which was
    unnecessary, as it can close itself. So, that
    part is also removed.

 src/plugins/gvls/gvls_plugin.py          | 17 ++++-------------
 src/plugins/intelephense/intelephense.py |  4 +++-
 2 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/gvls/gvls_plugin.py b/src/plugins/gvls/gvls_plugin.py
index b34baec37..0a5051cd5 100644
--- a/src/plugins/gvls/gvls_plugin.py
+++ b/src/plugins/gvls/gvls_plugin.py
@@ -72,24 +72,14 @@ class GVlsService(Ide.Object):
         self._client = value
         self.notify('client')
 
-    def do_parent_set(self, parent):
-        """
-        No useful for VLS
-        """
-        if parent is None:
-            return
-
-    def do_destroy(self):
+    @staticmethod
+    def on_destroy(self):
         """
         Stops the Vala Language Server upon request to shutdown the
         GVlsService.
         """
-        if self._client is not None:
-            Ide.warning ("Shutting down server")
-            self._client.stop()
-            self._client.destroy()
-
         if self._supervisor is not None:
+            Ide.warning('Stopping GVls supervisor')
             supervisor, self._supervisor = self._supervisor, None
             supervisor.stop()
 
@@ -572,6 +562,7 @@ class GVlsService(Ide.Object):
         context = provider.get_context()
         self = GVlsService.from_context(context)
         self._ensure_started()
+        self.connect('destroy', GVlsService.on_destroy)
         self.bind_property('client', provider, 'client', GObject.BindingFlags.SYNC_CREATE)
 
 class GVlsDiagnosticProvider(Ide.LspDiagnosticProvider, Ide.DiagnosticProvider):
diff --git a/src/plugins/intelephense/intelephense.py b/src/plugins/intelephense/intelephense.py
index 161f90495..068534b3f 100644
--- a/src/plugins/intelephense/intelephense.py
+++ b/src/plugins/intelephense/intelephense.py
@@ -30,7 +30,8 @@ class PhpService(Ide.Object):
         self._client = value
         self.notify('client')
 
-    def do_destroy(self):
+    @staticmethod
+    def on_destroy(self):
         if self._supervisor:
             supervisor, self._supervisor = self._supervisor, None
             supervisor.stop()
@@ -137,6 +138,7 @@ class PhpService(Ide.Object):
         self = PhpService.from_context(context)
         self._context = context
         self._ensure_started()
+        self.connect('destroy', PhpService.on_destroy)
         self.bind_property('client', provider, 'client', GObject.BindingFlags.SYNC_CREATE)
 
 class PhpLspSymbolResolver(Ide.LspSymbolResolver, Ide.SymbolResolver):


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