Commit 258aa307 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

fixed minor memory leaks

parent 6a4b1d8d
......@@ -804,6 +804,8 @@ upload_photo_file_buffer_ready_cb (void **buffer,
}
g_list_free (keys);
g_free (description);
g_free (title);
g_hash_table_unref (data_set);
}
......
......@@ -1064,6 +1064,8 @@ _gth_browser_update_open_menu (GthBrowser *browser)
else
g_menu_item_set_icon (item, icon);
g_menu_append_item (data->open_with_menu, item);
g_object_unref (item);
}
gth_window_enable_action (GTH_WINDOW (browser), "open-with-application", data->applications != NULL);
......@@ -1155,7 +1157,7 @@ fm__gth_browser_file_list_key_press_cb (GthBrowser *browser,
* for example: when viewing a catalog removes
* the files from the catalog; when viewing a
* folder removes the files from the folder. */
source = gth_browser_get_location_source (browser);
source = _g_object_ref (gth_browser_get_location_source (browser));
location = gth_browser_get_location_data (browser);
}
else {
......@@ -1183,6 +1185,7 @@ fm__gth_browser_file_list_key_press_cb (GthBrowser *browser,
_g_object_list_unref (file_data_list);
_gtk_tree_path_list_free (items);
_g_object_unref (source);
}
break;
}
......
......@@ -1372,6 +1372,8 @@ post_photo_file_buffer_ready_cb (void **buffer,
g_free (tags);
g_list_free (keys);
g_free (description);
g_free (title);
g_hash_table_unref (data_set);
}
......
......@@ -63,6 +63,7 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
gboolean format_recognized;
GFileInputStream *stream;
char *description = NULL;
gboolean free_description = FALSE;
int width;
int height;
const char *mime_type = NULL;
......@@ -229,6 +230,7 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
if (format != NULL) {
format_recognized = TRUE;
description = gdk_pixbuf_format_get_description (format);
free_description = TRUE;
}
g_free (filename);
......@@ -253,6 +255,9 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
g_free (size);
}
if (free_description)
g_free (description);
}
......
......@@ -613,6 +613,8 @@ upload_photo_file_buffer_ready_cb (void **buffer,
g_list_free (keys);
g_free (url);
g_free (s_size);
g_free (description);
g_free (title);
g_hash_table_unref (data_set);
}
......
......@@ -977,11 +977,14 @@ post_photo_file_buffer_ready_cb (void **buffer,
value = gth_file_data_get_attribute_as_string (file_data, "general::title");
dom_element_append_child (entry,
dom_document_create_element_with_text (doc, value, "summary", NULL));
g_free (value);
value = gth_file_data_get_attribute_as_string (file_data, "general::location");
if (value != NULL)
if (value != NULL) {
dom_element_append_child (entry,
dom_document_create_element_with_text (doc, value, "gphoto:location", NULL));
g_free (value);
}
metadata = g_file_info_get_attribute_object (file_data->info, "general::tags");
if (metadata != NULL)
......
......@@ -665,6 +665,7 @@ external_thumbnailers_disabled_all_changed_cb (GSettings *set
factory->priv->disabled_types = NULL;
}
else {
g_strfreev (factory->priv->disabled_types);
factory->priv->disabled_types = g_settings_get_strv (factory->priv->settings, "disable");
gnome_desktop_thumbnail_factory_load_thumbnailers (factory);
}
......@@ -697,8 +698,10 @@ gnome_desktop_thumbnail_factory_init_scripts (GnomeDesktopThumbnailFactory *fact
(GDestroyNotify)thumbnailer_unref);
factory->priv->settings = g_settings_new ("org.gnome.desktop.thumbnailers");
factory->priv->disabled = g_settings_get_boolean (factory->priv->settings, "disable-all");
if (! factory->priv->disabled)
if (! factory->priv->disabled) {
g_strfreev (factory->priv->disabled_types);
factory->priv->disabled_types = g_settings_get_strv (factory->priv->settings, "disable");
}
g_signal_connect (factory->priv->settings,
"changed::disable-all",
G_CALLBACK (external_thumbnailers_disabled_all_changed_cb),
......@@ -782,6 +785,7 @@ gnome_desktop_thumbnail_factory_init (GnomeDesktopThumbnailFactory *factory)
{
factory->priv = GNOME_DESKTOP_THUMBNAIL_FACTORY_GET_PRIVATE (factory);
factory->priv->size = GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL;
factory->priv->disabled_types = NULL;
g_mutex_init (&factory->priv->lock);
gnome_desktop_thumbnail_factory_init_scripts (factory);
......
......@@ -300,6 +300,7 @@ gth_application_command_line (GApplication *application,
return EXIT_FAILURE;
}
g_option_context_free (context);
g_strfreev (argv);
gdk_notify_startup_complete ();
......
......@@ -2593,6 +2593,7 @@ gth_browser_finalize (GObject *object)
{
GthBrowser *browser = GTH_BROWSER (object);
g_list_free (browser->priv->fixed_viewer_controls);
g_hash_table_destroy (browser->priv->menu_managers);
browser_state_free (&browser->priv->state);
_g_object_unref (browser->priv->browser_settings);
......@@ -2760,20 +2761,21 @@ folder_tree_drag_motion_cb (GtkWidget *file_view,
/* use COPY if dropping a file in a catalog */
if (action == GDK_ACTION_MOVE) {
GthFileData *destination;
GthFileSource *file_source;
GthFileData *destination;
destination = gth_folder_tree_get_file (GTH_FOLDER_TREE (browser->priv->folder_tree), path);
if (destination != NULL) {
file_source = gth_main_get_file_source (destination->file);
_g_object_unref (destination);
GthFileSource *file_source = gth_main_get_file_source (destination->file);
_g_object_unref (destination);
if (file_source != NULL) {
if (gth_file_source_is_reorderable (file_source))
action = GDK_ACTION_COPY;
}
else
action = 0;
_g_object_unref (file_source);
}
else
action = 0;
......@@ -3036,6 +3038,8 @@ folder_tree_rename_cb (GthFolderTree *folder_tree,
file_source = gth_main_get_file_source (file);
gth_file_source_rename (file_source, file, new_name, file_source_rename_ready_cb, browser);
g_object_unref (file_source);
}
......@@ -7041,6 +7045,7 @@ _g_menu_item_new_for_file (GFile *file,
}
_g_object_unref (info);
_g_object_unref (file_source);
return item;
}
......@@ -239,6 +239,8 @@ gth_empty_list_draw (GtkWidget *widget,
gdk_cairo_set_source_rgba (cr, &color);
gtk_render_layout (style_context, cr, 0, (allocation.height - bounds.height) / 2, self->priv->layout);
cairo_fill (cr);
pango_font_description_free (font);
}
return FALSE;
......
......@@ -139,6 +139,7 @@ gth_folder_tree_finalize (GObject *object)
_g_object_list_unref (folder_tree->priv->monitor.sources);
if (folder_tree->priv->root != NULL)
g_object_unref (folder_tree->priv->root);
g_object_unref (folder_tree->priv->tree_store);
g_free (folder_tree->priv);
folder_tree->priv = NULL;
......@@ -418,7 +419,7 @@ get_monitor_file_source_for_file (GthFolderTree *folder_tree,
if (gth_file_source_supports_scheme (file_source, uri)) {
g_free (uri);
return file_source;
return g_object_ref (file_source);
}
}
......@@ -439,6 +440,8 @@ _gth_folder_tree_remove_from_monitor (GthFolderTree *folder_tree,
return;
gth_file_source_monitor_directory (file_source, file, FALSE);
g_object_unref (file_source);
}
......@@ -468,12 +471,13 @@ _gth_folder_tree_add_to_monitor (GthFolderTree *folder_tree,
file_source = gth_main_get_file_source (file);
if (file_source == NULL)
return;
folder_tree->priv->monitor.sources = g_list_prepend (folder_tree->priv->monitor.sources, file_source);
folder_tree->priv->monitor.sources = g_list_prepend (folder_tree->priv->monitor.sources, g_object_ref (file_source));
}
gth_file_source_monitor_directory (file_source, file, TRUE);
g_hash_table_add (folder_tree->priv->monitor.locations, g_file_dup (file));
g_object_unref (file_source);
}
......
......@@ -167,7 +167,7 @@ create_menu_item (const char *label,
{
GMenuItem *item;
item = g_menu_item_new (label,detailed_action);
item = g_menu_item_new (label, detailed_action);
g_menu_item_set_attribute (item, _G_MENU_ATTRIBUTE_DETAILED_ACTION, "s", detailed_action, NULL);
if (accel != NULL)
g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
......@@ -205,6 +205,8 @@ gth_menu_manager_append_entries (GthMenuManager *menu_manager,
g_menu_append_item (menu_manager->priv->menu, item);
items = g_list_prepend (items, g_strdup (entry->detailed_action));
g_object_unref (item);
}
items = g_list_reverse (items);
......@@ -302,4 +304,6 @@ gth_menu_manager_append_entry (GthMenuManager *menu_manager,
items = g_hash_table_lookup (menu_manager->priv->items, GINT_TO_POINTER (merge_id));
items = g_list_append (items, g_strdup (detailed_action));
g_hash_table_insert (menu_manager->priv->items, GINT_TO_POINTER (merge_id), items);
g_object_unref (item);
}
......@@ -756,10 +756,11 @@ gth_window_change_action_state (GthWindow *window,
g_return_if_fail (action != NULL);
old_state = g_action_get_state (action);
new_state = g_variant_new_boolean (value);
new_state = g_variant_ref_sink (g_variant_new_boolean (value));
if ((old_state == NULL) || ! g_variant_equal (old_state, new_state))
g_action_change_state (action, new_state);
if (old_state != NULL)
g_variant_unref (old_state);
g_variant_unref (new_state);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment