[Spice-devel] [PATCH spice-server 5/6] dispatcher: Remove "opaque" property
Jonathon Jongsma
jjongsma at redhat.com
Thu Sep 7 15:37:31 UTC 2017
On Thu, 2017-09-07 at 16:50 +0200, Christophe Fergeau wrote:
> Acked-by: Christophe Fergeau <cfergeau at redhat.com>
>
> On Thu, Sep 07, 2017 at 12:40:25PM +0100, Frediano Ziglio wrote:
> > Is supposed to be used during initialization but is never
> > used.
> >
Hmm, I find this commit log to be a bit misleading. It implies that the
the Dispatcher no longer has an 'opaque' property. In reality, it still
has this property, it just is no longer a "GObject property" but is
only a simple struct member. 'opaque' is definitely used. It is passed
to all of the message handlers. It was never set in the constructor,
but later we call dispatcher_set_opaque() to set this value.
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> > server/dispatcher.c | 22 ++--------------------
> > server/dispatcher.h | 2 +-
> > server/red-qxl.c | 2 +-
> > 3 files changed, 4 insertions(+), 22 deletions(-)
> >
> > diff --git a/server/dispatcher.c b/server/dispatcher.c
> > index 6f2c4d85e..9e02d901b 100644
> > --- a/server/dispatcher.c
> > +++ b/server/dispatcher.c
> > @@ -66,8 +66,7 @@ struct DispatcherPrivate {
> >
> > enum {
> > PROP_0,
> > - PROP_MAX_MESSAGE_TYPE,
> > - PROP_OPAQUE
> > + PROP_MAX_MESSAGE_TYPE
> > };
> >
> > static void
> > @@ -83,9 +82,6 @@ dispatcher_get_property(GObject *object,
> > case PROP_MAX_MESSAGE_TYPE:
> > g_value_set_uint(value, self->priv->max_message_type);
> > break;
> > - case PROP_OPAQUE:
> > - g_value_set_pointer(value, self->priv->opaque);
> > - break;
> > default:
> > G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id,
> > pspec);
> > }
> > @@ -104,9 +100,6 @@ dispatcher_set_property(GObject *object,
> > case PROP_MAX_MESSAGE_TYPE:
> > self->priv->max_message_type =
> > g_value_get_uint(value);
> > break;
> > - case PROP_OPAQUE:
> > - dispatcher_set_opaque(self,
> > g_value_get_pointer(value));
> > - break;
> > default:
> > G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id,
> > pspec);
> > }
> > @@ -168,15 +161,6 @@ dispatcher_class_init(DispatcherClass *klass)
> > G_PARAM_STAT
> > IC_STRINGS |
> > G_PARAM_READ
> > WRITE |
> > G_PARAM_CONS
> > TRUCT_ONLY));
> > - g_object_class_install_property(object_class,
> > - PROP_OPAQUE,
> > - g_param_spec_pointer("opaque",
> > - "opaque",
> > - "User
> > data to pass to callbacks",
> > - G_PARAM_S
> > TATIC_STRINGS |
> > - G_PARAM_R
> > EADWRITE |
> > - G_PARAM_C
> > ONSTRUCT));
> > -
> > }
> >
> > static void
> > @@ -186,11 +170,10 @@ dispatcher_init(Dispatcher *self)
> > }
> >
> > Dispatcher *
> > -dispatcher_new(size_t max_message_type, void *opaque)
> > +dispatcher_new(size_t max_message_type)
> > {
> > return g_object_new(TYPE_DISPATCHER,
> > "max-message-type", (guint)
> > max_message_type,
> > - "opaque", opaque,
> > NULL);
> > }
> >
> > @@ -419,7 +402,6 @@ static void setup_dummy_signal_handler(void)
> > void dispatcher_set_opaque(Dispatcher *self, void *opaque)
> > {
> > self->priv->opaque = opaque;
> > - g_object_notify(G_OBJECT(self), "opaque");
> > }
> >
> > int dispatcher_get_recv_fd(Dispatcher *dispatcher)
> > diff --git a/server/dispatcher.h b/server/dispatcher.h
> > index 97b01de9c..00a828bdb 100644
> > --- a/server/dispatcher.h
> > +++ b/server/dispatcher.h
> > @@ -49,7 +49,7 @@ struct DispatcherClass
> >
> > GType dispatcher_get_type(void) G_GNUC_CONST;
> >
> > -Dispatcher *dispatcher_new(size_t max_message_type, void *opaque);
> > +Dispatcher *dispatcher_new(size_t max_message_type);
> >
> >
> > typedef void (*dispatcher_handle_message)(void *opaque,
> > diff --git a/server/red-qxl.c b/server/red-qxl.c
> > index b1804cf17..d876dc079 100644
> > --- a/server/red-qxl.c
> > +++ b/server/red-qxl.c
> > @@ -939,7 +939,7 @@ void red_qxl_init(RedsState *reds, QXLInstance
> > *qxl)
> > qxl_state->qxl = qxl;
> > pthread_mutex_init(&qxl_state->scanout_mutex, NULL);
> > qxl_state->scanout.drm_dma_buf_fd = -1;
> > - qxl_state->dispatcher =
> > dispatcher_new(RED_WORKER_MESSAGE_COUNT, NULL);
> > + qxl_state->dispatcher =
> > dispatcher_new(RED_WORKER_MESSAGE_COUNT);
> > qxl_state->qxl_worker.major_version =
> > SPICE_INTERFACE_QXL_MAJOR;
> > qxl_state->qxl_worker.minor_version =
> > SPICE_INTERFACE_QXL_MINOR;
> > qxl_state->qxl_worker.wakeup = qxl_worker_wakeup;
> > --
> > 2.13.5
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list