summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/bookmark_bar_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 20:27:55 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 20:27:55 +0000
commitea6e33667659f0d3fea27bd64a80a412d4b02bca (patch)
treed634fd35a3a6e1f0ad5698cbe564587bd6e6539e /chrome/browser/gtk/bookmark_bar_gtk.cc
parent836add1222d83d8d3d59fe11b9720d2c03445a11 (diff)
downloadchromium_src-ea6e33667659f0d3fea27bd64a80a412d4b02bca.zip
chromium_src-ea6e33667659f0d3fea27bd64a80a412d4b02bca.tar.gz
chromium_src-ea6e33667659f0d3fea27bd64a80a412d4b02bca.tar.bz2
Don't crash when dragging bookmarks from one bookmark bar to another (as with multiple chrome windows).
BUG=none TEST=drag a bookmark icon from one a bookmark bar to a bar in another window without crashing. Review URL: http://codereview.chromium.org/119114 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_bar_gtk.cc')
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index 9fd896c..96d298b 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -104,6 +104,8 @@ BookmarkBarGtk::BookmarkBarGtk(Profile* profile, Browser* browser)
browser_(browser),
model_(NULL),
instructions_(NULL),
+ dragged_node_(NULL),
+ toolbar_drop_item_(NULL),
show_instructions_(true) {
Init(profile);
SetProfile(profile);
@@ -609,7 +611,6 @@ void BookmarkBarGtk::OnButtonDragBegin(GtkWidget* button,
DCHECK(node);
bar->dragged_node_ = node;
- bar->toolbar_drop_item_ = NULL;
// Build a windowed representation for our button.
GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP);
@@ -736,16 +737,22 @@ gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkToolbar* toolbar,
return FALSE;
}
- if (!bar->toolbar_drop_item_) {
+ // TODO(estade): Improve support for drags from outside this particular
+ // bookmark bar.
+ if (!bar->toolbar_drop_item_ && bar->dragged_node_) {
bar->toolbar_drop_item_ = bar->CreateBookmarkToolItem(bar->dragged_node_);
g_object_ref_sink(GTK_OBJECT(bar->toolbar_drop_item_));
}
+ if (bar->toolbar_drop_item_) {
+ gint index = gtk_toolbar_get_drop_index(toolbar, x, y);
+ gtk_toolbar_set_drop_highlight_item(toolbar,
+ GTK_TOOL_ITEM(bar->toolbar_drop_item_),
+ index);
+ }
+
gdk_drag_status(context, GDK_ACTION_MOVE, time);
- gint index = gtk_toolbar_get_drop_index(toolbar, x, y);
- gtk_toolbar_set_drop_highlight_item(toolbar,
- GTK_TOOL_ITEM(bar->toolbar_drop_item_),
- index);
+
return TRUE;
}