Skip to content

Commit

Permalink
Fix crash that permission_prompt#reset is called during destruction
Browse files Browse the repository at this point in the history
1. Per crash stack, the crash is caused by that weakRef#reset is called
during destruction.

Calling permission_prompt_->Closing() will destroy the object, and
then statements after this can be sometimes dangerous.

2. polish PermissionPromptAndroid by removing unused header

Bug: 1303047
Change-Id: I613418e07989390317852c37419fc572845d8834
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3514638
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Lijin Shen <lazzzis@google.com>
Cr-Commit-Position: refs/heads/main@{#980818}
  • Loading branch information
Lijin Shen authored and Chromium LUCI CQ committed Mar 14, 2022
1 parent ad8124f commit 7615a8e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ void NotificationBlockedMessageDelegate::Delegate::Closing() {
if (!permission_prompt_)
return;
permission_prompt_->Closing();
permission_prompt_.reset();
}

void NotificationBlockedMessageDelegate::Delegate::SetManageClicked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ PermissionPromptAndroid::PermissionPromptAndroid(

PermissionPromptAndroid::~PermissionPromptAndroid() {
if (message_delegate_) {
message_delegate_.reset();
return;
}
infobars::InfoBarManager* infobar_manager =
Expand Down
1 change: 0 additions & 1 deletion components/permissions/android/permission_prompt_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "base/memory/weak_ptr.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/infobars/core/infobar_manager.h"
#include "components/messages/android/message_wrapper.h"
#include "components/permissions/permission_prompt.h"
#include "components/permissions/permission_uma_util.h"
#include "components/permissions/permissions_client.h"
Expand Down

0 comments on commit 7615a8e

Please sign in to comment.