Commit b692e77f authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Fix order of operations in undo action popout.

Current code does not cause a problem with this order of operations, but
changes we want to make for the attached bug uncovers a situation where
the action is still popped out after its view is removed, which causes
an error.

Bug: 898632
Change-Id: I73d14a61cddd4b052c9dbf774864f68036a93b4c
Reviewed-on: https://chromium-review.googlesource.com/c/1372710Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615726}
parent 109c41de
......@@ -4,7 +4,9 @@
#include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
#include <algorithm>
#include <set>
#include <string>
#include <utility>
#include "base/auto_reset.h"
......@@ -649,9 +651,12 @@ void ToolbarActionsBar::OnToolbarActionRemoved(const std::string& action_id) {
std::unique_ptr<ToolbarActionViewController> removed_action =
std::move(*iter);
toolbar_actions_.erase(iter);
delegate_->RemoveViewForAction(removed_action.get());
// If we kill the view before we undo the popout, highlights and pop-ups can
// get left in weird states, so undo the popout first.
if (popped_out_action_ == removed_action.get())
UndoPopOut();
delegate_->RemoveViewForAction(removed_action.get());
removed_action.reset();
// If the extension is being upgraded we don't want the bar to shrink
......
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