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

Unified Diff: chrome/browser/ui/libgtkui/gtk_status_icon.cc

Issue 2696903003: Gtk3: Fix memory leaks (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | chrome/browser/ui/libgtkui/gtk_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/gtk_status_icon.cc
diff --git a/chrome/browser/ui/libgtkui/gtk_status_icon.cc b/chrome/browser/ui/libgtkui/gtk_status_icon.cc
index d97899ba019b67b70fd85df540f254ac95fffbc1..c42da5021cbc756185040cb28d00fbfd431f3ef9 100644
--- a/chrome/browser/ui/libgtkui/gtk_status_icon.cc
+++ b/chrome/browser/ui/libgtkui/gtk_status_icon.cc
@@ -6,6 +6,7 @@
#include <gtk/gtk.h>
+#include "base/debug/leak_annotations.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/libgtkui/app_indicator_icon_menu.h"
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
@@ -19,7 +20,16 @@ namespace libgtkui {
Gtk2StatusIcon::Gtk2StatusIcon(const gfx::ImageSkia& image,
const base::string16& tool_tip) {
GdkPixbuf* pixbuf = GdkPixbufFromSkBitmap(*image.bitmap());
- gtk_status_icon_ = gtk_status_icon_new_from_pixbuf(pixbuf);
+ {
+#if GTK_MAJOR_VERSION == 3
+ // Gtk3 has a bug that leaks 384 bytes when creating a
+ // GtkStatusIcon. It will not be fixed since the status icon was
+ // deprectaed in version 3.14. Luckily, Chromium doesn't need to
+ // create a status icon very often, if at all.
+ ANNOTATE_SCOPED_MEMORY_LEAK;
+#endif
+ gtk_status_icon_ = gtk_status_icon_new_from_pixbuf(pixbuf);
+ }
g_object_unref(pixbuf);
g_signal_connect(gtk_status_icon_, "activate", G_CALLBACK(OnClickThunk),
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/gtk_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698