[Spice-devel] [PATCH 08/19] Hook up main_dispatcher_constructed()

Frediano Ziglio fziglio at redhat.com
Tue Feb 16 14:32:51 UTC 2016


From: Jonathon Jongsma <jjongsma at redhat.com>

Forgot to implement hook up this vfunc in the class init function, so we
were getting a crash on the main dispatcher. We also need to make sure
that we chain up to the parent vfunc.

    #0  0x00007fffed0478c7 in __GI_raise (sig=sig at entry=6) at
    ../sysdeps/unix/sysv/linux/raise.c:55
    #1  0x00007fffed04952a in __GI_abort () at abort.c:89
    #2  0x00007fffed04046d in __assert_fail_base (fmt=0x7fffed19a1f8
    "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion at entry=0x7ffff7b8cf28
    "dispatcher->priv->messages[message_type].handler",
    file=file at entry=0x7ffff7b8cede "dispatcher.c", line=line at entry=324,
    function=function at entry=0x7ffff7b8d210 <__PRETTY_FUNCTION__.16179>
    "dispatcher_send_message") at assert.c:92
    #3  0x00007fffed040522 in __GI___assert_fail (assertion=0x7ffff7b8cf28
    "dispatcher->priv->messages[message_type].handler", file=0x7ffff7b8cede
    "dispatcher.c", line=324, function=0x7ffff7b8d210
    <__PRETTY_FUNCTION__.16179> "dispatcher_send_message") at assert.c:101
    #4  0x00007ffff7a89367 in dispatcher_send_message
    (dispatcher=0x55555625f0c0 [MainDispatcher], message_type=2,
    payload=0x7fffdd1fe5a0) at dispatcher.c:324
    #5  0x00007ffff7a8d3da in main_dispatcher_set_mm_time_latency
    (self=0x55555625f0c0 [MainDispatcher], client=0x5555564d2740, latency=0)
    at main-dispatcher.c:260
---
 server/dispatcher.c      | 2 ++
 server/main-dispatcher.c | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/server/dispatcher.c b/server/dispatcher.c
index 2c04eb4..cd2f2cb 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -121,6 +121,8 @@ static void dispatcher_constructed(GObject *object)
     Dispatcher *self = DISPATCHER(object);
     int channels[2];
 
+    G_OBJECT_CLASS(dispatcher_parent_class)->constructed(object);
+
 #ifdef DEBUG_DISPATCHER
     setup_dummy_signal_handler();
 #endif
diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c
index 6b8ca53..bc0de24 100644
--- a/server/main-dispatcher.c
+++ b/server/main-dispatcher.c
@@ -104,6 +104,8 @@ main_dispatcher_set_property(GObject      *object,
     }
 }
 
+static void main_dispatcher_constructed(GObject *object);
+
 static void
 main_dispatcher_class_init(MainDispatcherClass *klass)
 {
@@ -111,6 +113,7 @@ main_dispatcher_class_init(MainDispatcherClass *klass)
 
     g_type_class_add_private(klass, sizeof(MainDispatcherPrivate));
 
+    object_class->constructed = main_dispatcher_constructed;
     object_class->get_property = main_dispatcher_get_property;
     object_class->set_property = main_dispatcher_set_property;
 
@@ -297,6 +300,8 @@ MainDispatcher* main_dispatcher_new(RedsState *reds, SpiceCoreInterfaceInternal
 void main_dispatcher_constructed(GObject *object)
 {
     MainDispatcher *self = MAIN_DISPATCHER(object);
+
+    G_OBJECT_CLASS(main_dispatcher_parent_class)->constructed(object);
     dispatcher_set_opaque(DISPATCHER(self), self);
 
     self->priv->core->watch_add(self->priv->core,
-- 
2.5.0



More information about the Spice-devel mailing list