[gnome-builder/wip/chergert/langserv] langserv-client: use copy of inserted text
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/langserv] langserv-client: use copy of inserted text
- Date: Mon, 24 Oct 2016 07:44:35 +0000 (UTC)
commit 756f6457d5b062a183e812bb2c01aef1f363eb78
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 24 00:44:12 2016 -0700
langserv-client: use copy of inserted text
There is no guarantee that text is \0 terminated, at least from what I
can tell. So this makes a copy first before dispatching.
We should still convert this ot use delay+piece-table, but that is for
another day.
libide/langserv/ide-langserv-client.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/libide/langserv/ide-langserv-client.c b/libide/langserv/ide-langserv-client.c
index b1a11a1..f4d7e25 100644
--- a/libide/langserv/ide-langserv-client.c
+++ b/libide/langserv/ide-langserv-client.c
@@ -137,6 +137,7 @@ ide_langserv_client_buffer_insert_text (IdeLangservClient *self,
{
g_autoptr(JsonNode) params = NULL;
g_autofree gchar *uri = NULL;
+ g_autofree gchar *copy = NULL;
gint line;
gint column;
gint version;
@@ -145,6 +146,8 @@ ide_langserv_client_buffer_insert_text (IdeLangservClient *self,
g_assert (location != NULL);
g_assert (IDE_IS_BUFFER (buffer));
+ copy = g_strndup (new_text, len);
+
uri = ide_buffer_get_uri (buffer);
version = (gint)ide_buffer_get_change_count (buffer);
@@ -169,7 +172,7 @@ ide_langserv_client_buffer_insert_text (IdeLangservClient *self,
"}",
"}",
"rangeLength", JCON_INT (0),
- "text", JCON_STRING (new_text),
+ "text", JCON_STRING (copy),
"}",
"]");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]