cheese r426 - in trunk: . src
- From: jhaitsma svn gnome org
- To: svn-commits-list gnome org
- Subject: cheese r426 - in trunk: . src
- Date: Tue, 22 Jan 2008 01:08:38 +0000 (GMT)
Author: jhaitsma
Date: Tue Jan 22 01:08:37 2008
New Revision: 426
URL: http://svn.gnome.org/viewvc/cheese?rev=426&view=rev
Log:
Plug some leaks. Apply patches of Mauro <mukadr gmail com> of GHOP project. Bug #505441
Modified:
trunk/ChangeLog
trunk/src/cheese-countdown.c
trunk/src/cheese-fileutil.c
trunk/src/cheese-thumb-view.c
trunk/src/cheese-webcam.c
trunk/src/cheese-window.c
Modified: trunk/src/cheese-countdown.c
==============================================================================
--- trunk/src/cheese-countdown.c (original)
+++ trunk/src/cheese-countdown.c Tue Jan 22 01:08:37 2008
@@ -250,6 +250,7 @@
if (!pSvgHandle)
{
g_print ("Could not load file %s!\n", pcFilename);
+ g_error_free(pError);
return NULL;
}
@@ -294,30 +295,33 @@
cheese_countdown_cb (gpointer countdown)
{
CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
- if (priv->iState == STATE_OFF)
- {
- // should just ignore it, testing purposes
- g_print("Should not happen, unitialized state in countdown handler\n");
- }
- else if (priv->iState == STATE_3)
- {
- priv->iState = STATE_2;
- }
- else if (priv->iState == STATE_2)
- {
- priv->iState = STATE_1;
- }
- else if (priv->iState == STATE_1)
- {
- priv->iState = STATE_SMILE;
- if (priv->picture_callback != NULL) (priv->picture_callback)(priv->callback_data);
- }
- else if (priv->iState == STATE_SMILE)
+
+ switch (priv->iState)
{
- priv->iState = STATE_OFF;
- if (priv->hide_callback != NULL) (priv->hide_callback)(priv->callback_data);
- return FALSE;
+ case STATE_OFF:
+ // should just ignore it, testing purposes
+ g_print("Should not happen, unitialized state in countdown handler\n");
+ break;
+
+ case STATE_3:
+ priv->iState = STATE_2;
+ break;
+
+ case STATE_2:
+ priv->iState = STATE_1;
+ break;
+
+ case STATE_1:
+ priv->iState = STATE_SMILE;
+ if (priv->picture_callback != NULL) (priv->picture_callback)(priv->callback_data);
+ break;
+
+ case STATE_SMILE:
+ priv->iState = STATE_OFF;
+ if (priv->hide_callback != NULL) (priv->hide_callback)(priv->callback_data);
+ return FALSE;
}
+
return TRUE;
}
Modified: trunk/src/cheese-fileutil.c
==============================================================================
--- trunk/src/cheese-fileutil.c (original)
+++ trunk/src/cheese-fileutil.c Tue Jan 22 01:08:37 2008
@@ -61,6 +61,7 @@
filename_num = num;
}
}
+ g_dir_close(dir);
}
filename_num++;
Modified: trunk/src/cheese-thumb-view.c
==============================================================================
--- trunk/src/cheese-thumb-view.c (original)
+++ trunk/src/cheese-thumb-view.c Tue Jan 22 01:08:37 2008
@@ -110,6 +110,10 @@
return;
}
}
+ gnome_vfs_file_info_unref(file_info);
+ g_object_unref (factory);
+ g_free(thumb_loc);
+ g_free(uri);
eog_thumbnail_add_frame (&pixbuf);
@@ -143,6 +147,7 @@
break;
}
}
+ g_free(path);
gtk_list_store_remove (priv->store, &iter);
}
Modified: trunk/src/cheese-webcam.c
==============================================================================
--- trunk/src/cheese-webcam.c (original)
+++ trunk/src/cheese-webcam.c Tue Jan 22 01:08:37 2008
@@ -909,6 +909,7 @@
effect_filter = gst_parse_bin_from_description (effects_pipeline_desc, TRUE, &err);
if (!effect_filter || (err != NULL))
{
+ g_error_free(err);
g_error ("ERROR effect_filter\n");
}
cheese_webcam_change_effect_filter (webcam, effect_filter);
Modified: trunk/src/cheese-window.c
==============================================================================
--- trunk/src/cheese-window.c (original)
+++ trunk/src/cheese-window.c Tue Jan 22 01:08:37 2008
@@ -178,6 +178,7 @@
gtk_widget_set_sensitive (cheese_window->take_picture, TRUE);
}
+
static void
cheese_window_cmd_close (GtkWidget *widget, CheeseWindow *cheese_window)
{
@@ -185,7 +186,16 @@
g_object_unref (cheese_window->webcam);
g_object_unref (cheese_window->actions_main);
g_object_unref (cheese_window->actions_photo);
+ g_object_unref (cheese_window->actions_mail);
+ g_object_unref (cheese_window->actions_toggle);
+ g_object_unref (cheese_window->actions_effects);
+ g_object_unref (cheese_window->actions_file);
+ g_object_unref (cheese_window->actions_video);
+ g_object_unref (cheese_window->actions_account_photo);
+ g_object_unref (cheese_window->actions_fspot);
+ g_object_unref (cheese_window->actions_flickr);
g_object_unref (cheese_window->ui_manager);
+
g_free (cheese_window);
gtk_main_quit ();
}
@@ -270,11 +280,12 @@
gtk_widget_destroy (dlg);
g_free (header);
}
+ g_free(target_filename);
}
+ g_free(filename);
gtk_widget_destroy (dialog);
}
-
static void
cheese_window_cmd_move_file_to_trash (CheeseWindow *cheese_window, GList *files)
{
@@ -284,25 +295,24 @@
GtkWidget *error_dialog;
for (l = files; l != NULL; l = l->next) {
- error = NULL;
-
- if (!g_file_trash (l->data, NULL, &error)) {
- primary = g_strdup (_("Cannot move file to trash"));
- secondary = g_strdup_printf (_("The file \"%s\" cannot be moved to the trash. Details: %s"),
- g_file_get_basename (l->data), error->message);
-
- error_dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, primary);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
- secondary);
- gtk_dialog_run (GTK_DIALOG (error_dialog));
- gtk_widget_destroy (error_dialog);
-
- g_free (primary);
- g_free (secondary);
- /*TODO if we can't move files to trash, maybe we should try to delete them....*/
- }
+ if (!g_file_trash (l->data, NULL, &error)) {
+ primary = g_strdup (_("Cannot move file to trash"));
+ secondary = g_strdup_printf (_("The file \"%s\" cannot be moved to the trash. Details: %s"),
+ g_file_get_basename (l->data), error->message);
+
+ error_dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, primary);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
+ secondary);
+ gtk_dialog_run (GTK_DIALOG (error_dialog));
+ gtk_widget_destroy (error_dialog);
+
+ g_free (primary);
+ g_free (secondary);
+ g_error_free(error);
+ /*TODO if we can't move files to trash, maybe we should try to delete them....*/
+ }
}
}
@@ -354,6 +364,7 @@
}
cheese_window_cmd_move_file_to_trash (cheese_window, files_list);
g_list_free (files_list);
+ g_dir_close(dir);
}
static void
@@ -367,6 +378,7 @@
g_return_if_fail (filename);
file = g_file_new_for_path (filename);
+ g_free(filename);
files_list = g_list_append (files_list, file);
cheese_window_cmd_move_file_to_trash (cheese_window, files_list);
@@ -421,13 +433,16 @@
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
g_free (header);
+ g_error_free (error);
}
g_free (*data);
}
+ g_free(filename);
g_object_unref (pixbuf);
}
}
+
static void
cheese_window_cmd_command_line (GtkAction *action, CheeseWindow *cheese_window)
{
@@ -755,7 +770,7 @@
if (!audio_play)
{
g_warning (error ? error->message : "Unknown error");
- g_clear_error (&error);
+ g_error_free (error);
}
g_free (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]