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

Side by Side Diff: base/mime_util_linux.cc

Issue 155515: Fix leak of g_object_get value. This was showing up on the (Closed)
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
« no previous file with comments | « no previous file | no next file » | 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 "base/mime_util.h" 5 #include "base/mime_util.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <sys/time.h> 8 #include <sys/time.h>
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 default_themes[1] = IconTheme::LoadTheme(kde_default_theme); 503 default_themes[1] = IconTheme::LoadTheme(kde_default_theme);
504 default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme); 504 default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme);
505 } else { 505 } else {
506 // Assume it's Gnome and use GTK to figure out the theme. 506 // Assume it's Gnome and use GTK to figure out the theme.
507 gchar* gtk_theme_name; 507 gchar* gtk_theme_name;
508 g_object_get(gtk_settings_get_default(), 508 g_object_get(gtk_settings_get_default(),
509 "gtk-icon-theme-name", 509 "gtk-icon-theme-name",
510 &gtk_theme_name, NULL); 510 &gtk_theme_name, NULL);
511 default_themes[1] = IconTheme::LoadTheme(gtk_theme_name); 511 default_themes[1] = IconTheme::LoadTheme(gtk_theme_name);
512 default_themes[2] = IconTheme::LoadTheme("gnome"); 512 default_themes[2] = IconTheme::LoadTheme("gnome");
513 g_free(gtk_theme_name);
513 } 514 }
514 // hicolor needs to be last per icon theme spec. 515 // hicolor needs to be last per icon theme spec.
515 default_themes[3] = IconTheme::LoadTheme("hicolor"); 516 default_themes[3] = IconTheme::LoadTheme("hicolor");
516 517
517 for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) { 518 for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) {
518 if (default_themes[i] == NULL) 519 if (default_themes[i] == NULL)
519 continue; 520 continue;
520 // NULL out duplicate pointers. 521 // NULL out duplicate pointers.
521 for (size_t j = i + 1; j < MimeUtilConstants::kDefaultThemeNum; j++) { 522 for (size_t j = i + 1; j < MimeUtilConstants::kDefaultThemeNum; j++) {
522 if (default_themes[j] == default_themes[i]) 523 if (default_themes[j] == default_themes[i])
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } else { 605 } else {
605 icon_file = LookupIconInDefaultTheme(icon_names[i], size); 606 icon_file = LookupIconInDefaultTheme(icon_names[i], size);
606 if (!icon_file.empty()) 607 if (!icon_file.empty())
607 return icon_file; 608 return icon_file;
608 } 609 }
609 } 610 }
610 return FilePath(); 611 return FilePath();
611 } 612 }
612 613
613 } // namespace mime_util 614 } // namespace mime_util
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698