Commit 4f5f0949 authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

Revert "Fix the issue that ARC app can't start from shelf after switch users."

This reverts commit 2359557a.

Reason for revert: heap-buffer-overflow found by ASAN bot, likely due to accessing std::map<>::end() returned by std::map<>::find().

Original change's description:
> Fix the issue that ARC app can't start from shelf after switch users.
> 
> The reason is that OnItemDelegateDiscarded is called, and the
> controller is deleted from app_shelf_group_to_controller_map_, even
> though the parameter delegate is not the controller saved in
> app_shelf_group_to_controller_map_. So adding a checking in
> OnItemDelegateDiscarded, only when the parameter delegate is the
> controller saved in app_shelf_group_to_controller_map_, delete it,
> otherwise, don't delete the controller in
> app_shelf_group_to_controller_map_.
> 
> BUG=1011235
> 
> Change-Id: I300b5fc4a46b9441a063c34bac745a5018aa5b82
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976140
> Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#726710}

TBR=xiyuan@chromium.org,nancylingwang@chromium.org

Change-Id: I3c8ee654bd33b2a5235815c01ad6ed1957309c0c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1011235
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1979539Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727034}
parent b95a2319
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/multi_user_window_manager.h" #include "ash/public/cpp/multi_user_window_manager.h"
#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/shelf_model.h" #include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
...@@ -359,13 +358,10 @@ void AppServiceAppWindowArcTracker::RemoveCandidateWindow( ...@@ -359,13 +358,10 @@ void AppServiceAppWindowArcTracker::RemoveCandidateWindow(
} }
void AppServiceAppWindowArcTracker::OnItemDelegateDiscarded( void AppServiceAppWindowArcTracker::OnItemDelegateDiscarded(
const ash::ShelfID& shelf_id, const ash::ShelfID& shelf_id) {
ash::ShelfItemDelegate* delegate) {
arc::ArcAppShelfId app_shelf_id = arc::ArcAppShelfId app_shelf_id =
arc::ArcAppShelfId::FromString(shelf_id.app_id); arc::ArcAppShelfId::FromString(shelf_id.app_id);
auto it = app_shelf_group_to_controller_map_.find(app_shelf_id); app_shelf_group_to_controller_map_.erase(app_shelf_id);
if (static_cast<ash::ShelfItemDelegate*>(it->second) == delegate)
app_shelf_group_to_controller_map_.erase(app_shelf_id);
} }
ash::ShelfID AppServiceAppWindowArcTracker::GetShelfId(int task_id) const { ash::ShelfID AppServiceAppWindowArcTracker::GetShelfId(int task_id) const {
......
...@@ -20,10 +20,6 @@ namespace arc { ...@@ -20,10 +20,6 @@ namespace arc {
class ArcAppShelfId; class ArcAppShelfId;
} }
namespace ash {
class ShelfItemDelegate;
}
namespace aura { namespace aura {
class window; class window;
} }
...@@ -82,8 +78,7 @@ class AppServiceAppWindowArcTracker : public ArcAppListPrefs::Observer, ...@@ -82,8 +78,7 @@ class AppServiceAppWindowArcTracker : public ArcAppListPrefs::Observer,
void RemoveCandidateWindow(aura::Window* window); void RemoveCandidateWindow(aura::Window* window);
// Removes controller from |app_shelf_group_to_controller_map_|. // Removes controller from |app_shelf_group_to_controller_map_|.
void OnItemDelegateDiscarded(const ash::ShelfID& shelf_id, void OnItemDelegateDiscarded(const ash::ShelfID& shelf_id);
ash::ShelfItemDelegate* delegate);
ash::ShelfID GetShelfId(int task_id) const; ash::ShelfID GetShelfId(int task_id) const;
......
...@@ -498,7 +498,7 @@ void AppServiceAppWindowLauncherController::OnItemDelegateDiscarded( ...@@ -498,7 +498,7 @@ void AppServiceAppWindowLauncherController::OnItemDelegateDiscarded(
continue; continue;
if (arc_tracker_) if (arc_tracker_)
arc_tracker_->OnItemDelegateDiscarded(app_window->shelf_id(), delegate); arc_tracker_->OnItemDelegateDiscarded(app_window->shelf_id());
if (!app_window || app_window->controller() != delegate) if (!app_window || app_window->controller() != delegate)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment