diff options
author | Tao Bao <tbao@google.com> | 2018-06-06 20:07:02 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-06 20:07:02 +0200 |
commit | b4aad37e2102ef1685f9cb19d842d7c8293e3644 (patch) | |
tree | 0d2df0d2ecd10ea6824557b4a1d62bdac1c110eb | |
parent | Merge "tests: Specify the death test style to avoid flakiness." am: 878d5a77f0 (diff) | |
parent | Merge "ui: join only if joinable." (diff) | |
download | android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.tar android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.tar.gz android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.tar.bz2 android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.tar.lz android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.tar.xz android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.tar.zst android_bootable_recovery-b4aad37e2102ef1685f9cb19d842d7c8293e3644.zip |
-rw-r--r-- | screen_ui.cpp | 4 | ||||
-rw-r--r-- | tests/unit/screen_ui_test.cpp | 5 | ||||
-rw-r--r-- | ui.cpp | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp index b9aba807d..b4ef054ce 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -173,7 +173,9 @@ ScreenRecoveryUI::ScreenRecoveryUI(bool scrollable_menu) ScreenRecoveryUI::~ScreenRecoveryUI() { progress_thread_stopped_ = true; - progress_thread_.join(); + if (progress_thread_.joinable()) { + progress_thread_.join(); + } } GRSurface* ScreenRecoveryUI::GetCurrentFrame() const { diff --git a/tests/unit/screen_ui_test.cpp b/tests/unit/screen_ui_test.cpp index 2179b729f..a3dd2add9 100644 --- a/tests/unit/screen_ui_test.cpp +++ b/tests/unit/screen_ui_test.cpp @@ -293,6 +293,11 @@ TEST_F(ScreenRecoveryUITest, Init) { ASSERT_FALSE(ui_->WasTextEverVisible()); } +TEST_F(ScreenRecoveryUITest, dtor_NotCallingInit) { + ui_.reset(); + ASSERT_FALSE(ui_); +} + TEST_F(ScreenRecoveryUITest, ShowText) { ASSERT_TRUE(ui_->Init(kTestLocale)); ASSERT_FALSE(ui_->IsTextVisible()); @@ -78,7 +78,9 @@ RecoveryUI::RecoveryUI() RecoveryUI::~RecoveryUI() { ev_exit(); input_thread_stopped_ = true; - input_thread_.join(); + if (input_thread_.joinable()) { + input_thread_.join(); + } } void RecoveryUI::OnKeyDetected(int key_code) { |