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
=== modified file 'src/Unity/scope.cpp'
--- src/Unity/scope.cpp 2014-07-25 15:30:02 +0000
+++ src/Unity/scope.cpp 2014-07-31 11:01:32 +0000
@@ -608,7 +608,16 @@
608608
609QString Scope::searchHint() const609QString Scope::searchHint() const
610{610{
611 return QString::fromStdString(m_scopeMetadata ? m_scopeMetadata->search_hint() : "");611 std::string search_hint;
612 try {
613 if (m_scopeMetadata) {
614 search_hint = m_scopeMetadata->search_hint();
615 }
616 } catch (...) {
617 // throws if the value isn't set, safe to ignore
618 }
619
620 return QString::fromStdString(search_hint);
612}621}
613622
614bool Scope::searchInProgress() const623bool Scope::searchInProgress() const
615624
=== modified file 'tests/data/mock-scope-ttl/mock-scope-ttl.ini.in'
--- tests/data/mock-scope-ttl/mock-scope-ttl.ini.in 2014-05-15 08:21:45 +0000
+++ tests/data/mock-scope-ttl/mock-scope-ttl.ini.in 2014-07-31 11:01:32 +0000
@@ -1,9 +1,6 @@
1[ScopeConfig]1[ScopeConfig]
2DisplayName = mock-ttl.DisplayName2DisplayName = mock-ttl.DisplayName
3Description = mock-ttl.Description3Description = mock-ttl.Description
4Art = /mock-ttl.Art
5Icon = /mock-ttl.Icon4Icon = /mock-ttl.Icon
6SearchHint = mock-ttl.SearchHint
7HotKey = mock-ttl.HotKey
8Author = mock-ttl.Author5Author = mock-ttl.Author
9ResultsTtlType = Small6ResultsTtlType = Small
107
=== modified file 'tests/resultstest.cpp'
--- tests/resultstest.cpp 2014-07-18 16:35:52 +0000
+++ tests/resultstest.cpp 2014-07-31 11:01:32 +0000
@@ -189,9 +189,18 @@
189 QCOMPARE(headerCustomizations["background"], QVariant("color://black"));189 QCOMPARE(headerCustomizations["background"], QVariant("color://black"));
190 QCOMPARE(customizations["shape-images"], QVariant(false));190 QCOMPARE(customizations["shape-images"], QVariant(false));
191191
192 QCOMPARE(m_scope->isActive(), false);
193 m_scope->setActive(true);
192 QCOMPARE(m_scope->isActive(), true);194 QCOMPARE(m_scope->isActive(), true);
193 m_scope->setActive(false);195
194 QCOMPARE(m_scope->isActive(), false);196 QCOMPARE(m_scope_ttl->id(), QString("mock-scope-ttl"));
197 QCOMPARE(m_scope_ttl->name(), QString("mock-ttl.DisplayName"));
198 QCOMPARE(m_scope_ttl->iconHint(), QString("/mock-ttl.Icon"));
199 QCOMPARE(m_scope_ttl->description(), QString("mock-ttl.Description"));
200 QCOMPARE(m_scope_ttl->searchHint(), QString());
201 QCOMPARE(m_scope_ttl->shortcut(), QString());
202 QCOMPARE(m_scope_ttl->visible(), true);
203 QCOMPARE(m_scope_ttl->searchQuery(), QString());
195 }204 }
196205
197 void testCategoryQuery()206 void testCategoryQuery()

Subscribers

People subscribed via source and target branches

to all changes: