[virt-tools-list] [PATCH 1/2] session: Only create a hashtable if apply_monitor_geometry class exists

Jonathon Jongsma jjongsma at redhat.com
Wed Oct 21 13:42:13 UTC 2015


ACK, but I'd like a couple changes to the commit log:

- in the summary: apply_monitor_geometry is a vfunc, not a class
- add a comment to the commit log explaining that this is to avoid a
memory leak when we return early.


On Wed, 2015-10-21 at 15:23 +0200, Fabiano Fidêncio wrote:
> Related: rhbz#1267184
> ---
>  src/virt-viewer-session.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
> index 2699f41..92ffd3f 100644
> --- a/src/virt-viewer-session.c
> +++ b/src/virt-viewer-session.c
> @@ -405,13 +405,15 @@
> virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession*
> self,
>      VirtViewerSessionClass *klass;
>      gboolean all_fullscreen = TRUE;
>      /* GHashTable<gint, GdkRectangle*> */
> -    GHashTable *monitors = g_hash_table_new_full(g_direct_hash,
> g_direct_equal, NULL, g_free);
> +    GHashTable *monitors;
>      GList *l;
>  
>      klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
>      if (!klass->apply_monitor_geometry)
>          return;
>  
> +    monitors = g_hash_table_new_full(g_direct_hash, g_direct_equal,
> NULL, g_free);
> +
>      for (l = self->priv->displays; l; l = l->next) {
>          VirtViewerDisplay *d = VIRT_VIEWER_DISPLAY(l->data);
>          guint nth = 0;




More information about the virt-tools-list mailing list