Code review comment for lp:~unity-team/unity/unity.fix-sc-icon-to-launcher-animation-981168

Revision history for this message
Gord Allott (gordallott) wrote :

just a quick fix needed on this branch,
first the we need to g_free the _sc_* pointers in the destructor

Then secondly, in this code, after g_free'ing the pointers the pointers should be set to NULL:

25 +
26 + if (_sc_anim_icon)
27 + {
28 + launcher_addrequest_special.emit(_sc_icon_desktop_file, AbstractLauncherIcon::Ptr(), _sc_icon_aptdaemon_task, _sc_icon, _sc_icon_x, _sc_icon_y, _sc_icon_size);
29 + g_free(_sc_icon);
30 + g_free(_sc_icon_title);
31 + g_free(_sc_icon_desktop_file);
32 + g_free(_sc_icon_aptdaemon_task);
33 + _sc_anim_icon = false;
34 + }

Then thirdly, before this code we should be g_free'ing the pointers to ensure there is no possible memory leak

58 + self->_sc_anim_icon = true;
59 + g_variant_get(parameters, "(ssiiiss)", &self->_sc_icon_title,
60 + &self->_sc_icon,
61 + &self->_sc_icon_x,
62 + &self->_sc_icon_y,
63 + &self->_sc_icon_size,
64 + &self->_sc_icon_desktop_file,
65 + &self->_sc_icon_aptdaemon_task, NULL);

Other than that, looks good to me

review: Needs Fixing

« Back to merge proposal