[gnome-builder] completion: handle loss of client
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] completion: handle loss of client
- Date: Thu, 4 Mar 2021 01:08:35 +0000 (UTC)
commit 4c3ab66dbeb29bb9063785d2cb7a809675c578fa
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 3 17:07:38 2021 -0800
completion: handle loss of client
src/libide/lsp/ide-lsp-completion-provider.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-completion-provider.c b/src/libide/lsp/ide-lsp-completion-provider.c
index e0cbf3bc6..6ddb7e586 100644
--- a/src/libide/lsp/ide-lsp-completion-provider.c
+++ b/src/libide/lsp/ide-lsp-completion-provider.c
@@ -148,8 +148,8 @@ ide_lsp_completion_provider_get_client (IdeLspCompletionProvider *self)
static void
on_notify_server_capabilities_cb (IdeLspCompletionProvider *self,
- GParamSpec *pspec,
- IdeLspClient *client)
+ GParamSpec *pspec,
+ IdeLspClient *client)
{
IdeLspCompletionProviderPrivate *priv = ide_lsp_completion_provider_get_instance_private (self);
GVariant *capabilities;
@@ -193,12 +193,16 @@ ide_lsp_completion_provider_set_client (IdeLspCompletionProvider *self,
if (g_set_object (&priv->client, client))
{
- g_signal_connect_object (client,
- "notify::server-capabilities",
- G_CALLBACK (on_notify_server_capabilities_cb),
- self,
- G_CONNECT_SWAPPED);
- on_notify_server_capabilities_cb (self, NULL, client);
+ if (client != NULL)
+ {
+ g_signal_connect_object (client,
+ "notify::server-capabilities",
+ G_CALLBACK (on_notify_server_capabilities_cb),
+ self,
+ G_CONNECT_SWAPPED);
+ on_notify_server_capabilities_cb (self, NULL, client);
+ }
+
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CLIENT]);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]