Merge lp:~unity-team/unity-scopes-shell/catch-no-search-hint into lp:unity-scopes-shell

Proposed by Michal Hruby
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 111
Merged at revision: 113
Proposed branch: lp:~unity-team/unity-scopes-shell/catch-no-search-hint
Merge into: lp:unity-scopes-shell
Diff against target: 60 lines (+21/-6)
3 files modified
src/Unity/scope.cpp (+10/-1)
tests/data/mock-scope-ttl/mock-scope-ttl.ini.in (+0/-3)
tests/resultstest.cpp (+11/-2)
To merge this branch: bzr merge lp:~unity-team/unity-scopes-shell/catch-no-search-hint
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+228288@code.launchpad.net

Commit message

Don't let the exception from search_hint() kill unity.

Description of the change

Don't let the exception from search_hint() kill unity.

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

Makes sense and fixes the crash i was having.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
112. By Michal Hruby

Merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Unity/scope.cpp'
2--- src/Unity/scope.cpp 2014-07-25 15:30:02 +0000
3+++ src/Unity/scope.cpp 2014-07-31 11:01:32 +0000
4@@ -608,7 +608,16 @@
5
6 QString Scope::searchHint() const
7 {
8- return QString::fromStdString(m_scopeMetadata ? m_scopeMetadata->search_hint() : "");
9+ std::string search_hint;
10+ try {
11+ if (m_scopeMetadata) {
12+ search_hint = m_scopeMetadata->search_hint();
13+ }
14+ } catch (...) {
15+ // throws if the value isn't set, safe to ignore
16+ }
17+
18+ return QString::fromStdString(search_hint);
19 }
20
21 bool Scope::searchInProgress() const
22
23=== modified file 'tests/data/mock-scope-ttl/mock-scope-ttl.ini.in'
24--- tests/data/mock-scope-ttl/mock-scope-ttl.ini.in 2014-05-15 08:21:45 +0000
25+++ tests/data/mock-scope-ttl/mock-scope-ttl.ini.in 2014-07-31 11:01:32 +0000
26@@ -1,9 +1,6 @@
27 [ScopeConfig]
28 DisplayName = mock-ttl.DisplayName
29 Description = mock-ttl.Description
30-Art = /mock-ttl.Art
31 Icon = /mock-ttl.Icon
32-SearchHint = mock-ttl.SearchHint
33-HotKey = mock-ttl.HotKey
34 Author = mock-ttl.Author
35 ResultsTtlType = Small
36
37=== modified file 'tests/resultstest.cpp'
38--- tests/resultstest.cpp 2014-07-18 16:35:52 +0000
39+++ tests/resultstest.cpp 2014-07-31 11:01:32 +0000
40@@ -189,9 +189,18 @@
41 QCOMPARE(headerCustomizations["background"], QVariant("color://black"));
42 QCOMPARE(customizations["shape-images"], QVariant(false));
43
44+ QCOMPARE(m_scope->isActive(), false);
45+ m_scope->setActive(true);
46 QCOMPARE(m_scope->isActive(), true);
47- m_scope->setActive(false);
48- QCOMPARE(m_scope->isActive(), false);
49+
50+ QCOMPARE(m_scope_ttl->id(), QString("mock-scope-ttl"));
51+ QCOMPARE(m_scope_ttl->name(), QString("mock-ttl.DisplayName"));
52+ QCOMPARE(m_scope_ttl->iconHint(), QString("/mock-ttl.Icon"));
53+ QCOMPARE(m_scope_ttl->description(), QString("mock-ttl.Description"));
54+ QCOMPARE(m_scope_ttl->searchHint(), QString());
55+ QCOMPARE(m_scope_ttl->shortcut(), QString());
56+ QCOMPARE(m_scope_ttl->visible(), true);
57+ QCOMPARE(m_scope_ttl->searchQuery(), QString());
58 }
59
60 void testCategoryQuery()

Subscribers

People subscribed via source and target branches

to all changes: