Merge lp:~mterry/lightdm/memleaks into lp:lightdm

Proposed by Michael Terry
Status: Merged
Merged at revision: 1495
Proposed branch: lp:~mterry/lightdm/memleaks
Merge into: lp:lightdm
Diff against target: 51 lines (+15/-1)
2 files modified
liblightdm-gobject/session.c (+13/-0)
liblightdm-gobject/user.c (+2/-1)
To merge this branch: bzr merge lp:~mterry/lightdm/memleaks
Reviewer Review Type Date Requested Status
Ken VanDine (community) Approve
Review via email: mp+103516@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) :
review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Also merged into 1.2 branch

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Also, I wasn't sure but is there an issue if you load the dmrc twice and it has removed a field?

if (!priv->dmrc_file)
   priv->dmrc_file = g_key_file_new ();

will cause the existing file to be used, should it be:

if (priv->dmrc_file)
    g_key_file_free (priv->dmrc_file);
priv->dmrc_file = g_key_file_new ();

instead?

Revision history for this message
Michael Terry (mterry) wrote :

It's fine to reuse the object, as g_key_file_load_from_file() clears the existing contents before loading new ones.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'liblightdm-gobject/session.c'
2--- liblightdm-gobject/session.c 2011-10-07 22:41:42 +0000
3+++ liblightdm-gobject/session.c 2012-04-25 17:06:32 +0000
4@@ -78,6 +78,7 @@
5
6 if (!full_path)
7 {
8+ g_free (name);
9 g_free (domain);
10 return NULL;
11 }
12@@ -266,6 +267,17 @@
13 }
14
15 static void
16+lightdm_session_finalize (GObject *object)
17+{
18+ LightDMSession *self = LIGHTDM_SESSION (object);
19+ LightDMSessionPrivate *priv = GET_PRIVATE (self);
20+
21+ g_free (priv->key);
22+ g_free (priv->name);
23+ g_free (priv->comment);
24+}
25+
26+static void
27 lightdm_session_class_init (LightDMSessionClass *klass)
28 {
29 GObjectClass *object_class = G_OBJECT_CLASS (klass);
30@@ -274,6 +286,7 @@
31
32 object_class->set_property = lightdm_session_set_property;
33 object_class->get_property = lightdm_session_get_property;
34+ object_class->finalize = lightdm_session_finalize;
35
36 g_object_class_install_property (object_class,
37 PROP_KEY,
38
39=== modified file 'liblightdm-gobject/user.c'
40--- liblightdm-gobject/user.c 2012-03-20 05:11:28 +0000
41+++ liblightdm-gobject/user.c 2012-04-25 17:06:32 +0000
42@@ -1120,7 +1120,8 @@
43 gchar *path;
44 //gboolean have_dmrc;
45
46- priv->dmrc_file = g_key_file_new ();
47+ if (!priv->dmrc_file)
48+ priv->dmrc_file = g_key_file_new ();
49
50 /* Load from the user directory */
51 path = g_build_filename (priv->home_directory, ".dmrc", NULL);

Subscribers

People subscribed via source and target branches