[Spice-devel] [PATCH spice-gtk] Do not call spice_egl_cursor_set when egl is disabled

Pavel Grunt pgrunt at redhat.com
Thu Apr 7 13:10:06 UTC 2016


Fix memory leaks of cursor:

240 bytes in 1 blocks are possibly lost in loss record 10,786 of 12,521
   at 0x4C2FA60: calloc (vg_replace_malloc.c:711)
   by 0x3700F861: ralloc_size (ralloc.c:113)
   by 0x36FD2D68: UnknownInlinedFun (list.h:83)
   by 0x36FD2D68: (anonymous namespace)::builtin_variable_generator::add_const(char const*, int) (builtin_variables.cpp:578)
   by 0x36FD4775: generate_constants (builtin_variables.cpp:725)
   by 0x36FD4775: _mesa_glsl_initialize_variables(exec_list*, _mesa_glsl_parse_state*) (builtin_variables.cpp:1303)
   by 0x36E03D26: create_new_program (ff_fragment_shader.cpp:1225)
   by 0x36E03D26: _mesa_get_fixed_func_fragment_program (ff_fragment_shader.cpp:1295)
   by 0x36E9A577: update_program (state.c:157)
   by 0x36E9A577: _mesa_update_state_locked (state.c:473)
   by 0x36E9A6A0: _mesa_update_state (state.c:504)
   by 0x36EB05E4: teximage (teximage.c:2947)
   by 0x36EB211F: _mesa_TexImage2D (teximage.c:3009)
   by 0x4E5024F: spice_egl_cursor_set (spice-widget-egl.c:497)
   by 0x4E4BFD7: cursor_set (spice-widget.c:2346)
   by 0x50D6245: g_cclosure_user_marshal_VOID__INT_INT_INT_INT_POINTER (spice-marshal.c:245)
---
 src/spice-widget-egl.c | 2 ++
 src/spice-widget.c     | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index c54d9f6..7611b0b 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -484,6 +484,8 @@ void spice_egl_cursor_set(SpiceDisplay *display)
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
     GdkPixbuf *image = d->mouse_pixbuf;
 
+    g_return_if_fail(d->egl.enabled);
+
     if (image == NULL)
         return;
 
diff --git a/src/spice-widget.c b/src/spice-widget.c
index f30b80f..6f638fb 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2343,7 +2343,8 @@ static void cursor_set(SpiceCursorChannel *channel,
         g_warn_if_reached();
 
 #ifndef G_OS_WIN32
-    spice_egl_cursor_set(display);
+    if (d->egl.enabled)
+        spice_egl_cursor_set(display);
 #endif
     if (d->show_cursor) {
         /* unhide */
-- 
2.8.0



More information about the Spice-devel mailing list