~ci-train-bot/lightdm/lightdm-ubuntu-zesty-1679

« back to all changes in this revision

Viewing changes to src/session.c

  • Committer: Robert Ancell
  • Date: 2015-10-16 10:20:03 UTC
  • Revision ID: robert.ancell@canonical.com-20151016102003-a5mt4x3hsln874w8
Use g_object_clear where we can for readibility

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
{
136
136
    g_return_if_fail (session != NULL);
137
137
 
138
 
    if (session->priv->config)
139
 
        g_object_unref (session->priv->config);
 
138
    g_clear_object (&session->priv->config);
140
139
    session->priv->config = g_object_ref (config);
141
140
}
142
141
 
246
245
session_set_x_authority (Session *session, XAuthority *authority, gboolean use_system_location)
247
246
{
248
247
    g_return_if_fail (session != NULL);
249
 
    if (session->priv->x_authority)
250
 
    {
251
 
        g_object_unref (session->priv->x_authority);
252
 
        session->priv->x_authority = NULL;
253
 
    }
 
248
    g_clear_object (&session->priv->x_authority);
254
249
    if (authority)
255
250
        session->priv->x_authority = g_object_ref (authority);
256
251
    session->priv->x_authority_use_system_location = use_system_location;
484
479
    {
485
480
        g_free (session->priv->username);
486
481
        session->priv->username = username;
487
 
        if (session->priv->user)
488
 
            g_object_unref (session->priv->user);
489
 
        session->priv->user = NULL;
 
482
        g_clear_object (&session->priv->user);
490
483
    }
491
484
    else
492
485
        g_free (username);