summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 22:07:57 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 22:07:57 +0000
commit27812a9eb68a33fe9d94034de7c959d194a6538d (patch)
tree2f182221ce5348ea201ed9a0b67f31902cff6c2d
parent0c16f746bb898f09d4ca1bba70577fae42756d15 (diff)
downloadchromium_src-27812a9eb68a33fe9d94034de7c959d194a6538d.zip
chromium_src-27812a9eb68a33fe9d94034de7c959d194a6538d.tar.gz
chromium_src-27812a9eb68a33fe9d94034de7c959d194a6538d.tar.bz2
Fix a crash on Linux which occurs during drag drop operations in the renderer while dereferncing
a NULL TabContentsWrapper pointer. Fix is to initialize the TCW member in the DragMotion event in the WebDragDestGtk object. This function is called at the start of the D&D operation. Added DCHECKs wherever we deref this member. There is no need to DCHECK the bookmark helper pointer as a TCW always has a bookmark helper object. BUG=89388 Review URL: http://codereview.chromium.org/7830022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99253 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/tab_contents/web_drag_dest_gtk.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.cc b/chrome/browser/tab_contents/web_drag_dest_gtk.cc
index 0737f6f..dbc8dac 100644
--- a/chrome/browser/tab_contents/web_drag_dest_gtk.cc
+++ b/chrome/browser/tab_contents/web_drag_dest_gtk.cc
@@ -90,9 +90,7 @@ void WebDragDestGtk::UpdateDragStatus(WebDragOperation operation) {
void WebDragDestGtk::DragLeave() {
tab_contents_->render_view_host()->DragTargetDragLeave();
- // TODO(thestig) Turn back to DCHECKs after we figure out bug 89388.
- CHECK(tab_);
- CHECK(tab_->bookmark_tab_helper());
+ DCHECK(tab_);
if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) {
tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()->OnDragLeave(
bookmark_drag_data_);
@@ -103,6 +101,14 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender,
GdkDragContext* context,
gint x, gint y,
guint time) {
+ // Ideally we would want to initialize the the TabContentsWrapper member in
+ // the constructor. We cannot do that as the WebDragDestGtk object is
+ // created during the construction of the TabContents object.
+ // The TabContentsWrapper is created much later.
+ if (!tab_) {
+ tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_);
+ DCHECK(tab_);
+ }
if (context_ != context) {
context_ = context;
drop_data_.reset(new WebDropData);
@@ -246,10 +252,7 @@ void WebDragDestGtk::OnDragDataReceived(
gtk_util::ScreenPoint(widget_),
gtk_util::GdkDragActionToWebDragOp(context->actions));
- if (!tab_) {
- tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_);
- DCHECK(tab_);
- }
+ DCHECK(tab_);
// This is non-null if tab_contents_ is showing an ExtensionWebUI with
// support for (at the moment experimental) drag and drop extensions.
if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate()) {