Merge lp:~bregma/geis/lp-966595 into lp:geis

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 239
Proposed branch: lp:~bregma/geis/lp-966595
Merge into: lp:geis
Diff against target: 19 lines (+8/-1)
1 file modified
testsuite/geistest/geistest.c (+8/-1)
To merge this branch: bzr merge lp:~bregma/geis/lp-966595
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Review via email: mp+100023@code.launchpad.net

Description of the change

Checks the return value of creating a subscription and prints an error and exits rather than segfaulting.

Fixes LP: #966595

To post a comment you must log in.
Revision history for this message
Chase Douglas (chasedouglas) wrote :

The error checking is good, but why does it error in the first place? Do we not care because it's in a code path that doesn't matter to us anymore? Or do we not have enough information?

review: Needs Information
Revision history for this message
Stephen M. Webb (bregma) wrote :

The failure to subscribe to gestures on the root window is because of the new functionality introduced by the recent rearchitecture of the uTouch stack. Previously, subscribing to gestures in a window while another client was also subscribed was not a failure condition but a normal successful condition. In the current case, Unity has already grabbed multi-touch events on the root window, so subsequent attempts will fail. This is not invalid behaviour, and the correct procedure is to explicitly specify a window to watch on the geistest command line.

The bug fix is to handle the segfault that results from trying to dereference a NULL pointer. The original code should have performed this check and handled the failure mode properly. It did not do so, but that code path was only recently exercised by the back-end behavioural changes.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Ahh, ok. Makes sense.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testsuite/geistest/geistest.c'
2--- testsuite/geistest/geistest.c 2012-02-14 18:10:21 +0000
3+++ testsuite/geistest/geistest.c 2012-03-29 20:37:42 +0000
4@@ -310,7 +310,14 @@
5 screen = xcb_setup_roots_iterator(setup);
6 for (int i = 0; screen.rem; ++i, xcb_screen_next(&screen))
7 {
8- *instance_table[i] = subscribe_window(screen.data->root);
9+ GeisInstance instance = subscribe_window(screen.data->root);
10+ if (!instance)
11+ {
12+ fprintf(stderr, "error subscribing window 0x%08x\n",
13+ (unsigned)screen.data->root);
14+ exit(1);
15+ }
16+ *instance_table[i] = instance;
17 }
18
19 xcb_disconnect(xcb);

Subscribers

People subscribed via source and target branches