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

Side by Side Diff: chrome/browser/gtk/tabs/tab_strip_gtk.cc

Issue 159166: gtk: Two fixes for the tab leak:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/tabs/tab_gtk.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" 5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/gfx/canvas_paint.h" 9 #include "app/gfx/canvas_paint.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 for (; it != tab_data_.end(); ++it) { 822 for (; it != tab_data_.end(); ++it) {
823 if (it->tab == tab) { 823 if (it->tab == tab) {
824 if (!model_->closing_all()) 824 if (!model_->closing_all())
825 NOTREACHED() << "Leaving in an inconsistent state!"; 825 NOTREACHED() << "Leaving in an inconsistent state!";
826 tab_data_.erase(it); 826 tab_data_.erase(it);
827 break; 827 break;
828 } 828 }
829 } 829 }
830 830
831 gtk_container_remove(GTK_CONTAINER(tabstrip_.get()), tab->widget()); 831 gtk_container_remove(GTK_CONTAINER(tabstrip_.get()), tab->widget());
832 delete tab; 832 // If we delete the dragged source tab here, the gtk drag-n-drop API won't
833 // get a change to clean up and remove any references it's added to the tab
834 // widget, so we'll leak the widget.
835 MessageLoop::current()->DeleteSoon(FROM_HERE, tab);
tony 2009/07/21 22:55:44 You're sure that the gtk d&d api will get to run b
833 836
834 // Force a layout here, because if we've just quickly drag detached a Tab, 837 // Force a layout here, because if we've just quickly drag detached a Tab,
835 // the stopping of the active animation above may have left the TabStrip in a 838 // the stopping of the active animation above may have left the TabStrip in a
836 // bad (visual) state. 839 // bad (visual) state.
837 Layout(); 840 Layout();
838 } 841 }
839 842
840 gfx::Rect TabStripGtk::GetIdealBounds(int index) { 843 gfx::Rect TabStripGtk::GetIdealBounds(int index) {
841 DCHECK(index >= 0 && index < GetTabCount()); 844 DCHECK(index >= 0 && index < GetTabCount());
842 return tab_data_.at(index).ideal_bounds; 845 return tab_data_.at(index).ideal_bounds;
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); 1922 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE);
1920 GtkWidget* browser_widget = GTK_WIDGET( 1923 GtkWidget* browser_widget = GTK_WIDGET(
1921 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); 1924 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle());
1922 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); 1925 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget));
1923 TabOverviewTypes::instance()->SendMessage(message); 1926 TabOverviewTypes::instance()->SendMessage(message);
1924 1927
1925 UserMetrics::RecordAction(L"TabOverview_PressedTabOverviewButton", 1928 UserMetrics::RecordAction(L"TabOverview_PressedTabOverviewButton",
1926 tabstrip->model_->profile()); 1929 tabstrip->model_->profile());
1927 } 1930 }
1928 #endif 1931 #endif
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_gtk.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698