Skip to contentSkip to conversation

char-pty: fix glib assert

PATCH In review Juan Quintela 3 participants 3 messages Jan 29, 2018 – Jan 30, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 char-pty: fix glib assert

I am having this assert over and over:

(process:30804): GLib-CRITICAL **: g_source_unref: assertion 'source != NULL' failed

gdb points to the line changed on this patch, and my reading of commit:

2c716ba1506769c9be2caa02f0f6d6e7c00f4304

is that it should be timer_src what is unrefered there.

But I don't claim to fully understand this code, so ....

Any comment?

Thanks, Juan.

CC Peter Xu <[email protected]>
CC Paolo Bonzini <[email protected]>
---
 chardev/char-pty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-pty.c +1 -1
index 89315e6807..c26e02bce8 100644
@@ -57,8 +57,8 @@ static gboolean pty_chr_timer(gpointer opaque)
     PtyChardev *s = PTY_CHARDEV(opaque);
 
     qemu_mutex_lock(&chr->chr_write_lock);
+    g_source_unref(s->timer_src);
     s->timer_src = NULL;
-    g_source_unref(s->open_source);
     s->open_source = NULL;
     if (!s->connected) {
         /* Next poll ... */
Signature · 1 line
2.14.3
#1 lore raw
Quoted 32 lines · Juan Quintela

I am having this assert over and over:

(process:30804): GLib-CRITICAL **: g_source_unref: assertion 'source != NULL' failed

gdb points to the line changed on this patch, and my reading of commit:

2c716ba1506769c9be2caa02f0f6d6e7c00f4304

is that it should be timer_src what is unrefered there.

But I don't claim to fully understand this code, so ....

Any comment?

Thanks, Juan.

CC Peter Xu <[email protected]>
CC Paolo Bonzini <[email protected]>
---
 chardev/char-pty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-pty.c +0 -0
index 89315e6807..c26e02bce8 100644

chardev/char-pty.c static gboolean pty_chr_timer(gpointer opaque) · line 64

Quoted 9 lines
chardev/char-pty.c +1 -1
@@ -57,8 +57,8 @@ static gboolean pty_chr_timer(gpointer opaque)
     PtyChardev *s = PTY_CHARDEV(opaque);
 
     qemu_mutex_lock(&chr->chr_write_lock);
+    g_source_unref(s->timer_src);
     s->timer_src = NULL;
-    g_source_unref(s->open_source);
     s->open_source = NULL;
     if (!s->connected) {
         /* Next poll ... */

If I read correctly the doc, we also need a g_source_destroy(s->timer_src). Perhaps we can directly call pty_chr_timer_cancel() here?

Thanks,
Laurent

#2 lore raw
Quoted 34 lines · Laurent Vivier
Quoted 33 lines · Juan Quintela

I am having this assert over and over:

(process:30804): GLib-CRITICAL **: g_source_unref: assertion 'source != NULL' failed

gdb points to the line changed on this patch, and my reading of commit:

2c716ba1506769c9be2caa02f0f6d6e7c00f4304

is that it should be timer_src what is unrefered there.

But I don't claim to fully understand this code, so ....

Any comment?

Thanks, Juan.

CC Peter Xu <[email protected]>
CC Paolo Bonzini <[email protected]>
---
 chardev/char-pty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-pty.c +0 -0
index 89315e6807..c26e02bce8 100644
@@ -57,8 +57,8 @@ static gboolean pty_chr_timer(gpointer opaque)
     PtyChardev *s = PTY_CHARDEV(opaque);
 
Quoted 12 lines

chardev/char-pty.c static gboolean pty_chr_timer(gpointer opaque) · line 64

Quoted 8 lines
chardev/char-pty.c +1 -1
     qemu_mutex_lock(&chr->chr_write_lock);
+    g_source_unref(s->timer_src);
     s->timer_src = NULL;
-    g_source_unref(s->open_source);
     s->open_source = NULL;
     if (!s->connected) {
         /* Next poll ... */

If I read correctly the doc, we also need a g_source_destroy(s->timer_src). Perhaps we can directly call pty_chr_timer_cancel() here?

Yes. Another fix is already queued by Paolo here:

http://patchwork.ozlabs.org/patch/862763/

Sorry for that!

Signature · 1 line
Peter Xu