Merge lp:~thumper/unity/fix-865840 into lp:unity

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 1861
Proposed branch: lp:~thumper/unity/fix-865840
Merge into: lp:unity
Diff against target: 14 lines (+1/-3)
1 file modified
plugins/unityshell/src/BamfLauncherIcon.cpp (+1/-3)
To merge this branch: bzr merge lp:~thumper/unity/fix-865840
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Sam Spilsbury (community) Approve
Review via email: mp+89812@code.launchpad.net

Commit message

Don't assign null to a std::string

Description of the change

The bamf call could return null when a window doesn't have a name.

We should never assign null to a std::string.

Not sure how to best test this, as we can't reproduce the problem, and bamf doesn't yet have mocking or faking.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Yep, that was something I planned to do too.
Nice.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/153/console reported an error when processing this lp:~thumper/unity/fix-865840 branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
2--- plugins/unityshell/src/BamfLauncherIcon.cpp 2012-01-15 19:01:11 +0000
3+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2012-01-24 02:22:25 +0000
4@@ -323,9 +323,7 @@
5 view = static_cast <BamfView*> (l->data);
6 if (BAMF_IS_WINDOW(view) && (Window) bamf_window_get_xid(BAMF_WINDOW(view)) == window)
7 {
8- gchar *name = bamf_view_get_name (view);
9- result = name;
10- g_free (name);
11+ result = glib::String(bamf_view_get_name(view)).Str();
12 break;
13 }
14 }