[Spice-devel] [PATCH 03/15] Free dispatchers at exit

Frediano Ziglio fziglio at redhat.com
Wed Mar 9 16:50:49 UTC 2016


> 
> From: Jonathon Jongsma <jjongsma at redhat.com>
> 
> ---
>  server/red-qxl.c | 7 +++++++
>  server/red-qxl.h | 1 +
>  server/reds.c    | 2 ++
>  3 files changed, 10 insertions(+)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index d209de6..80e0527 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -934,6 +934,13 @@ void red_qxl_gl_draw_async_complete(QXLState *qxl_state)
>      red_qxl_async_complete(qxl_state, async);
>  }
>  
> +void red_qxl_free(QXLState *qxl_state)
> +{
> +    g_object_unref(qxl_state->dispatcher);
> +    /* FIXME: free other stuff */
> +    free(qxl_state);
> +}
> +
>  void red_qxl_init(RedsState *reds, QXLInstance *qxl)
>  {
>      QXLState *qxl_state;
> diff --git a/server/red-qxl.h b/server/red-qxl.h
> index 16a348d..5e5c486 100644
> --- a/server/red-qxl.h
> +++ b/server/red-qxl.h
> @@ -26,6 +26,7 @@ typedef struct QXLState QXLState;
>  typedef struct AsyncCommand AsyncCommand;
>  
>  void red_qxl_init(SpiceServer *reds, QXLInstance *qxl);
> +void red_qxl_free(QXLState *qxl_state);
>  
>  void red_qxl_set_mm_time(QXLState *qxl_state, uint32_t);
>  void red_qxl_on_ic_change(QXLState *qxl_state, SpiceImageCompression ic);
> diff --git a/server/reds.c b/server/reds.c
> index bf52fb7..1b7d394 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -2759,9 +2759,11 @@ static int reds_init_ssl(RedsState *reds)
>  static void reds_destroy_internal(RedsState *reds)
>  {
>      g_array_unref(reds->renderers);
> +    g_object_unref(reds->main_dispatcher);
>      if (reds->main_channel) {
>          main_channel_close(reds->main_channel);
>      }
> +    g_list_free_full(reds->qxl_states, (GDestroyNotify)red_qxl_free);
>  #ifdef RED_STATISTICS
>      if (reds->stat_shm_name) {
>          shm_unlink(reds->stat_shm_name);

Not sure if this is the right way. Shouldn't the application call
spice_server_remove_interface ? This looks like we are removing all
QXL interfaces automatically.

Frediano


More information about the Spice-devel mailing list