[Spice-devel,v2,14/19] Free QXL instances in spice_server_destroy

Submitted by Frediano Ziglio on Nov. 25, 2016, 2:52 p.m.

Details

Message ID 4a41ca34fde8ba2a5db53e0f17bd1964a230d2af.1480085518.git-series.fziglio@redhat.com
State Superseded
Headers show
Series "Start cleaning objects on destruction" ( rev: 4 3 2 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 25, 2016, 2:52 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/reds.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/server/reds.c b/server/reds.c
index 701aed6..553e7a8 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3599,6 +3599,8 @@  SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
     servers = g_list_remove(servers, reds);
     pthread_mutex_unlock(&global_reds_lock);
 
+    g_list_free_full(reds->qxl_instances, (GDestroyNotify)red_qxl_destroy);
+
     if (reds->inputs_channel) {
         reds_unregister_channel(reds, RED_CHANNEL(reds->inputs_channel));
         red_channel_destroy(RED_CHANNEL(reds->inputs_channel));
@@ -3609,6 +3611,11 @@  SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
     if (reds->mig_timer) {
         reds_core_timer_remove(reds, reds->mig_timer);
     }
+
+    if (reds->main_dispatcher) {
+        g_object_unref(reds->main_dispatcher);
+    }
+
     reds_cleanup(reds);
 #ifdef RED_STATISTICS
     stat_file_free(reds->stat_file);

Comments

On Fri, 2016-11-25 at 14:52 +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  server/reds.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 701aed6..553e7a8 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3599,6 +3599,8 @@ SPICE_GNUC_VISIBLE void
> spice_server_destroy(SpiceServer *reds)
>      servers = g_list_remove(servers, reds);
>      pthread_mutex_unlock(&global_reds_lock);
>  
> +    g_list_free_full(reds->qxl_instances,
> (GDestroyNotify)red_qxl_destroy);

Ah g_list_free_full is GLIB 2.28, we require 2.22

There is a few of them already, imo is ok to bump the required version
to 2.28 since it is in el6 
> +
>      if (reds->inputs_channel) {
>          reds_unregister_channel(reds, RED_CHANNEL(reds-
> >inputs_channel));
>          red_channel_destroy(RED_CHANNEL(reds->inputs_channel));
> @@ -3609,6 +3611,11 @@ SPICE_GNUC_VISIBLE void
> spice_server_destroy(SpiceServer *reds)
>      if (reds->mig_timer) {
>          reds_core_timer_remove(reds, reds->mig_timer);
>      }
> +
> +    if (reds->main_dispatcher) {
> +        g_object_unref(reds->main_dispatcher);
> +    }
> +
>      reds_cleanup(reds);
>  #ifdef RED_STATISTICS
>      stat_file_free(reds->stat_file);
On Wed, Nov 30, 2016 at 06:40:26PM +0100, Pavel Grunt wrote:
> On Fri, 2016-11-25 at 14:52 +0000, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > ---
> >  server/reds.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/server/reds.c b/server/reds.c
> > index 701aed6..553e7a8 100644
> > --- a/server/reds.c
> > +++ b/server/reds.c
> > @@ -3599,6 +3599,8 @@ SPICE_GNUC_VISIBLE void
> > spice_server_destroy(SpiceServer *reds)
> >      servers = g_list_remove(servers, reds);
> >      pthread_mutex_unlock(&global_reds_lock);
> >  
> > +    g_list_free_full(reds->qxl_instances,
> > (GDestroyNotify)red_qxl_destroy);
> 
> Ah g_list_free_full is GLIB 2.28, we require 2.22
> 
> There is a few of them already, imo is ok to bump the required version
> to 2.28 since it is in el6 

Yes, definitely.

Christophe

> > +
> >      if (reds->inputs_channel) {
> >          reds_unregister_channel(reds, RED_CHANNEL(reds-
> > >inputs_channel));
> >          red_channel_destroy(RED_CHANNEL(reds->inputs_channel));
> > @@ -3609,6 +3611,11 @@ SPICE_GNUC_VISIBLE void
> > spice_server_destroy(SpiceServer *reds)
> >      if (reds->mig_timer) {
> >          reds_core_timer_remove(reds, reds->mig_timer);
> >      }
> > +
> > +    if (reds->main_dispatcher) {
> > +        g_object_unref(reds->main_dispatcher);
> > +    }
> > +
> >      reds_cleanup(reds);
> >  #ifdef RED_STATISTICS
> >      stat_file_free(reds->stat_file);
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel