diff options
-rw-r--r-- | chrome/browser/browser_theme_provider.h | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/extension_install_prompt_gtk.cc | 1 | ||||
-rw-r--r-- | chrome/browser/gtk/extension_installed_bubble_gtk.cc | 1 | ||||
-rw-r--r-- | chrome/browser/gtk/hung_renderer_dialog_gtk.cc | 10 | ||||
-rw-r--r-- | chrome/browser/gtk/keyword_editor_view.cc | 1 | ||||
-rw-r--r-- | gfx/gtk_util.h | 3 | ||||
-rw-r--r-- | tools/heapcheck/suppressions.txt | 7 | ||||
-rw-r--r-- | views/controls/menu/native_menu_gtk.cc | 1 |
8 files changed, 14 insertions, 12 deletions
diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h index 7545707..8ef628e 100644 --- a/chrome/browser/browser_theme_provider.h +++ b/chrome/browser/browser_theme_provider.h @@ -130,6 +130,8 @@ class BrowserThemeProvider : public NonThreadSafe, virtual bool HasCustomImage(int id) const; virtual RefCountedMemory* GetRawData(int id) const; #if defined(OS_LINUX) + // GdkPixbufs returned by GetPixbufNamed and GetRTLEnabledPixbufNamed are + // shared instances owned by the theme provider and should not be freed. virtual GdkPixbuf* GetPixbufNamed(int id) const; virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const; #elif defined(OS_MACOSX) diff --git a/chrome/browser/gtk/extension_install_prompt_gtk.cc b/chrome/browser/gtk/extension_install_prompt_gtk.cc index 5266a57..a0feb83 100644 --- a/chrome/browser/gtk/extension_install_prompt_gtk.cc +++ b/chrome/browser/gtk/extension_install_prompt_gtk.cc @@ -77,6 +77,7 @@ void ShowInstallPromptDialog(GtkWindow* parent, SkBitmap* skia_icon, // Put Icon in the left column. GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(skia_icon); GtkWidget* icon = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(pixbuf); gtk_box_pack_start(GTK_BOX(icon_hbox), icon, TRUE, TRUE, 0); // Create a new vbox for the right column. diff --git a/chrome/browser/gtk/extension_installed_bubble_gtk.cc b/chrome/browser/gtk/extension_installed_bubble_gtk.cc index 2ac515f..053fe15 100644 --- a/chrome/browser/gtk/extension_installed_bubble_gtk.cc +++ b/chrome/browser/gtk/extension_installed_bubble_gtk.cc @@ -150,6 +150,7 @@ void ExtensionInstalledBubbleGtk::ShowInternal() { gtk_box_pack_start(GTK_BOX(bubble_content), icon_column, FALSE, FALSE, kIconPadding); GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(pixbuf); gtk_box_pack_start(GTK_BOX(icon_column), image, FALSE, FALSE, 0); // Center text column. diff --git a/chrome/browser/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/gtk/hung_renderer_dialog_gtk.cc index ded88d6..4012b99 100644 --- a/chrome/browser/gtk/hung_renderer_dialog_gtk.cc +++ b/chrome/browser/gtk/hung_renderer_dialog_gtk.cc @@ -157,12 +157,15 @@ void HungRendererDialogGtk::ShowForTabContents(TabContents* hung_contents) { title = UTF16ToUTF8(TabContents::GetDefaultTitle()); SkBitmap favicon = it->GetFavIcon(); + GdkPixbuf* pixbuf = NULL; + if (favicon.width() > 0) + pixbuf = gfx::GdkPixbufFromSkBitmap(&favicon); gtk_list_store_set(model_, &tree_iter, - COL_FAVICON, favicon.width() > 0 - ? gfx::GdkPixbufFromSkBitmap(&favicon) - : NULL, + COL_FAVICON, pixbuf, COL_TITLE, title.c_str(), -1); + if (pixbuf) + g_object_unref(pixbuf); } } gtk_widget_show_all(GTK_WIDGET(dialog_)); @@ -223,4 +226,3 @@ void HideForTabContents(TabContents* contents) { } } // namespace hung_renderer_dialog - diff --git a/chrome/browser/gtk/keyword_editor_view.cc b/chrome/browser/gtk/keyword_editor_view.cc index e4bc1a5..d715db9 100644 --- a/chrome/browser/gtk/keyword_editor_view.cc +++ b/chrome/browser/gtk/keyword_editor_view.cc @@ -241,6 +241,7 @@ void KeywordEditorView::SetColumnValues(int model_row, GtkTreeIter* iter) { COL_KEYWORD, WideToUTF8(table_model_->GetText( model_row, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)).c_str(), -1); + g_object_unref(pixbuf); } int KeywordEditorView::GetListStoreRowForModelRow(int model_row) const { diff --git a/gfx/gtk_util.h b/gfx/gtk_util.h index a958d67..3a30ad9 100644 --- a/gfx/gtk_util.h +++ b/gfx/gtk_util.h @@ -35,7 +35,8 @@ extern const GdkColor kGdkBlack; extern const GdkColor kGdkGreen; // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so -// it is an expensive operation. +// it is an expensive operation. The returned GdkPixbuf will have a refcount of +// 1, and the caller is responsible for unrefing it when done. GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); // Modify the given region by subtracting the given rectangles. diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt index 6150b89..080bd7a 100644 --- a/tools/heapcheck/suppressions.txt +++ b/tools/heapcheck/suppressions.txt @@ -220,10 +220,3 @@ fun:ProfileSyncFactoryImpl::CreateProfileSyncService fun:TestingProfile::CreateProfileSyncService } - -{ - bug_38895 - Heapcheck:Leak - fun:gfx::GdkPixbufFromSkBitmap - fun:KeywordEditorView::SetColumnValues -} diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index 395e9a5..f551ed6 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -224,6 +224,7 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index, GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), gtk_image_new_from_pixbuf(pixbuf)); + g_object_unref(pixbuf); } else { menu_item = gtk_menu_item_new_with_mnemonic(label.c_str()); } |