Merge lp:~charlesk/lightdm/lp-1235915 into lp:lightdm

Proposed by Charles Kerr
Status: Merged
Merged at revision: 1937
Proposed branch: lp:~charlesk/lightdm/lp-1235915
Merge into: lp:lightdm
Diff against target: 13 lines (+3/-0)
1 file modified
liblightdm-gobject/layout.c (+3/-0)
To merge this branch: bzr merge lp:~charlesk/lightdm/lp-1235915
Reviewer Review Type Date Requested Status
Robert Ancell Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+211179@code.launchpad.net

Commit message

don't call xkl_config_rec_get_from_server if we don't have a valid xkl_engine.

Description of the change

don't call xkl_config_rec_get_from_server if we don't have a valid xkl_engine.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I'd prefer it like this:

     xkl_engine = xkl_engine_get_instance (display);
     if (!xkl_engine)
     {
         g_warning ("Failed to get Xkl engine for display '%p'", display);
         return laoyuts;
     }

i.e. no need to indent the entire function if nothing happens if the engine is NULL.

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

Is there a particular bug this is fixing? Looking at the xklavier source xkl_engine_get_instance should always return an object except in the case where display is NULL (which should probably be a g_assert).

Perhaps the correct fix here is to check if XOpenDisplay is NULL instead?

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

Oh, duh, now I see the bug.

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

And I see you came to much the same conclusion... So yeah, just make it check if XOpenDisplay has failed and then return from the function.

lp:~charlesk/lightdm/lp-1235915 updated
1932. By Charles Kerr

simplify the patch based on Robert's feedback

Revision history for this message
Charles Kerr (charlesk) wrote :

Simplified r1932.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'liblightdm-gobject/layout.c'
2--- liblightdm-gobject/layout.c 2013-01-31 20:56:09 +0000
3+++ liblightdm-gobject/layout.c 2014-03-17 17:11:38 +0000
4@@ -115,6 +115,9 @@
5 return layouts;
6
7 display = XOpenDisplay (NULL);
8+ if (display == NULL)
9+ return NULL;
10+
11 xkl_engine = xkl_engine_get_instance (display);
12 xkl_config = xkl_config_rec_new ();
13 if (!xkl_config_rec_get_from_server (xkl_config, xkl_engine))

Subscribers

People subscribed via source and target branches