Merge lp:~gerboland/unity-2d/no-active-window-crash into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 946
Merged at revision: 945
Proposed branch: lp:~gerboland/unity-2d/no-active-window-crash
Merge into: lp:unity-2d
Diff against target: 40 lines (+17/-2)
2 files modified
libunity-2d-private/src/unity2ddeclarativeview.cpp (+10/-2)
tests/manual-tests/dash.txt (+7/-0)
To merge this branch: bzr merge lp:~gerboland/unity-2d/no-active-window-crash
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Review via email: mp+95537@code.launchpad.net

Description of the change

Crash fix: Bamf can return NULL if there is no active window. Check BamfWindow* is not null before getting the window ID.

UNBLOCK

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

Should
if (active_window != this->effectiveWinId()) {
be extended to
if (active_window != this->effectiveWinId() && active_window != None) {
?

Or maybe just
Q_EMIT lastFocusedWindowChanged(m_last_focused_window);
if m_last_focused_window != active_window?

review: Needs Fixing
946. By Gerry Boland

Might as well add check only emit signal if last_focused_window actually changes

Revision history for this message
Albert Astals Cid (aacid) wrote :

Makes sense :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
2--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2012-02-27 10:47:50 +0000
3+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2012-03-02 12:04:26 +0000
4@@ -270,8 +270,16 @@
5 different by 1, which then could not be used with Bamf to
6 get the application. The change does not result in any functional
7 differences, though. */
8- WId active_window = BamfMatcher::get_default().active_window()->xid();
9- if (active_window != this->effectiveWinId()) {
10+ WId active_window = None;
11+ BamfWindow* bamf_active_window = BamfMatcher::get_default().active_window();
12+
13+ /* Bamf can return a null active window - example case is just after
14+ login when no application has been yet been started. */
15+ if (bamf_active_window != NULL) {
16+ active_window = bamf_active_window->xid();
17+ }
18+
19+ if (active_window != this->effectiveWinId() && active_window != m_last_focused_window) {
20 m_last_focused_window = active_window;
21 Q_EMIT lastFocusedWindowChanged(m_last_focused_window);
22 }
23
24=== modified file 'tests/manual-tests/dash.txt'
25--- tests/manual-tests/dash.txt 2012-02-28 12:00:25 +0000
26+++ tests/manual-tests/dash.txt 2012-03-02 12:04:26 +0000
27@@ -6,6 +6,13 @@
28 small, Dash should be locked to full-screen mode. (lp:860400)
29
30 ----
31+ * Newly installed Ubuntu, first boot to Unity 2D session
32+ * No applications have yet started or windows appear
33+ * Click the BFB in the Launcher *OR* Tap Alt to open HUD
34+
35+--> Shell should not crash. (lp:944724)
36+
37+----
38 * Press Alt+F2
39
40 --> Dash opens and "Run a command" is shown in the search field - (lp:883392)

Subscribers

People subscribed via source and target branches