stk: Handle null Text field.
PATCH 1/1 stk: Handle null Text field.
Add a NULL check in dbus_apply_text_attributes because in some places (like DisplayText handler) we call it without checking and we just check the return value once.
--- src/stk.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
src/stk.c +3 -0
@@ -303,6 +303,9 @@ static char *dbus_apply_text_attributes(const char *text,const uint8_t *j = attr->attributes;const uint8_t *end = j + attr->len; +if (!text) +return NULL ; +if (attr->len &3 )return NULL ;
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 1/1 gatchat: make sure to unsubscribe the GAtIO write handler on disconnect.
There's a small probability that we call chat_wakeup_writer just before the channel disonnects and for some reason glib then calls can_write_data after we have unrefed the io and freed all the resources. Calling at_chat_suspend unsubscribes can_write_data from the io.
--- gatchat/gatchat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
gatchat/gatchat.c +2 -0
@@ -40,6 +40,7 @@struct at_chat ;static void chat_wakeup_writer (struct at_chat *chat); +static void at_chat_suspend (struct at_chat *chat);static const char *none_prefix[] = {NULL };
@@ -364,6 +365,7 @@ static void io_disconnect(gpointer user_data)struct at_chat *chat = user_data;chat_cleanup (chat); +at_chat_suspend (chat);g_at_io_unref (chat->io); chat->io =NULL ;
Signature · 1 line
1.7.1.86.g0e460.dirty
Re: [PATCH] gatchat: make sure to unsubscribe the GAtIO write handler on disconnect.
Hi Andrew,
Quoted 14 lines · Andrzej Zaborowski
There's a small probability that we call
chat_wakeup_writerjust before the channel disonnects and for some reason glib then callscan_write_dataafter we have unrefed the io and freed all the resources. Callingat_chat_suspendunsubscribescan_write_datafrom the io.--- gatchat/gatchat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)gatchat/gatchat.c +0
-0
gatchat/gatchat.c line 43
Quoted 4 lines
gatchat/gatchat.c +1
-0@@ -40,6 +40,7 @@struct at_chat ;static void chat_wakeup_writer (struct at_chat *chat); +static void at_chat_suspend (struct at_chat *chat);
This is really against the coding standard ;)
gatchat/gatchat.c static void io_disconnect(gpointer user_data) · line 371
Quoted 11 lines
gatchat/gatchat.c +1
-0static const char *none_prefix[] = {NULL };@@ -364,6 +365,7 @@ static void io_disconnect(gpointer user_data)struct at_chat *chat = user_data;chat_cleanup (chat); +at_chat_suspend (chat);g_at_io_unref (chat->io); chat->io =NULL ;
Actually I think the right fix is to remove the write watcher in io_shutdown.
I pushed an experimental patch 99107c6c9d0ae42eb96621b0fc34972e418f1755, please let me know if this fixes the issue.
Regards,
-Denis
Re: [PATCH] gatchat: make sure to unsubscribe the GAtIO write handler on disconnect.
Quoted 5 lines · Denis Kenzior
Actually I think the right fix is to remove the write watcher in
io_shutdown.I pushed an experimental patch
99107c6c9d0ae42eb96621b0fc34972e418f1755, please let me know if this fixes the issue.
Yes, seems to have fixed the issue as well.
Thanks
Hi Andrew,
Quoted 7 lines · Andrzej Zaborowski
Add a NULL check in
dbus_apply_text_attributesbecause in some places (like DisplayText handler) we call it without checking and we just check the return value once.--- src/stk.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Patch has been applied, thanks.
Regards,
-Denis