Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc

Issue 7806015: Adds some debugging code to figure out why we crash when showing the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add setting value Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 10cf6882f4c57f48b7df489ec541312001e3b863..0e07ae805ba1ad2363d9738410f6f52a920c0a13 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
+#include "base/auto_reset.h"
#include "base/compiler_specific.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
@@ -138,11 +139,18 @@ class AutocompletePopupContentsView::AutocompletePopupWidget
: public views::Widget,
public base::SupportsWeakPtr<AutocompletePopupWidget> {
public:
- AutocompletePopupWidget() {}
- virtual ~AutocompletePopupWidget() {}
+ AutocompletePopupWidget() : check_on_destroy_(false) {}
+ virtual ~AutocompletePopupWidget() {
+ CHECK(!check_on_destroy_);
+ }
private:
- DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget);
+ // TODO(sky): remove once we figure out 92497.
+ friend class AutocompletePopupContentsView;
+
+ bool check_on_destroy_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutocompletePopupWidget);
};
class AutocompletePopupContentsView::InstantOptInView
@@ -238,7 +246,8 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
result_font_(font.DeriveFont(kEditFontAdjust)),
result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)),
ignore_mouse_drag_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)),
+ in_move_above_(false) {
// The following little dance is required because set_border() requires a
// pointer to a non-const object.
views::BubbleBorder* bubble_border =
@@ -250,6 +259,7 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
}
AutocompletePopupContentsView::~AutocompletePopupContentsView() {
+ CHECK(!in_move_above_);
// We don't need to do anything with |popup_| here. The OS either has already
// closed the window, in which case it's been deleted, or it will soon, in
// which case there's nothing we need to do.
@@ -304,6 +314,7 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
// triggered by the popup receiving a message (e.g. LBUTTONUP), and
// destroying the popup would cause us to read garbage when we unwind back
// to that level.
+ CHECK(!in_move_above_);
popup_->Close(); // This will eventually delete the popup.
popup_.reset();
}
@@ -362,8 +373,12 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
params.bounds = GetPopupBounds();
popup_->Init(params);
popup_->SetContentsView(this);
- popup_->MoveAbove(
- GetRelativeWindowForPopup(omnibox_view_->GetNativeView()));
+ {
+ AutoReset<bool> in_move_above_reset(&in_move_above_, true);
+ AutoReset<bool> check_on_destroy_reset(&popup_->check_on_destroy_, true);
+ popup_->MoveAbove(
+ GetRelativeWindowForPopup(omnibox_view_->GetNativeView()));
+ }
popup_->Show();
} else {
// Animate the popup shrinking, but don't animate growing larger since that
« no previous file with comments | « chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698