Merge lp:~brandontschaefer/unity/lp.1292647-fixes into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3745
Proposed branch: lp:~brandontschaefer/unity/lp.1292647-fixes
Merge into: lp:unity
Diff against target: 36 lines (+15/-0)
2 files modified
lockscreen/UserPromptView.cpp (+13/-0)
lockscreen/UserPromptView.h (+2/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1292647-fixes
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone (community) Approve
Review via email: mp+212705@code.launchpad.net

Commit message

When we see an escape in lockscreen prompt, clear the password.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

auto& focused_entry = focus_queue_.front();

Since it's seems defined on stl_deque.h as just:
 front() const { return *begin(); }

It might cause crashes (unlikely here, but still)... So I think it's just better if you instead do:

if (!focus_queue_.empty())
  focus_queue_.front()->SetText("");

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Marco's comment makes sense. Calling ::front on an empty container should be undefined behavior.

review: Needs Fixing
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/UserPromptView.cpp'
2--- lockscreen/UserPromptView.cpp 2014-03-06 21:37:45 +0000
3+++ lockscreen/UserPromptView.cpp 2014-03-26 18:53:46 +0000
4@@ -125,6 +125,19 @@
5 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
6 }
7
8+bool UserPromptView::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character)
9+{
10+ if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ESCAPE))
11+ {
12+ if (!focus_queue_.empty())
13+ focus_queue_.front()->SetText("");
14+
15+ return true;
16+ }
17+
18+ return false;
19+}
20+
21 void UserPromptView::ResetLayout()
22 {
23 focus_queue_.clear();
24
25=== modified file 'lockscreen/UserPromptView.h'
26--- lockscreen/UserPromptView.h 2014-03-05 04:09:13 +0000
27+++ lockscreen/UserPromptView.h 2014-03-26 18:53:46 +0000
28@@ -64,6 +64,8 @@
29 private:
30 void ResetLayout();
31
32+ bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
33+
34 session::Manager::Ptr session_manager_;
35 UserAuthenticatorPam user_authenticator_;
36 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;