[gtksourceview/wip/loader-saver] FileSaver: reset state
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/loader-saver] FileSaver: reset state
- Date: Wed, 26 Mar 2014 17:05:13 +0000 (UTC)
commit 4e47c1d509a7b7016c077bd1e4d6d63e09876a1d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Mar 26 17:13:21 2014 +0100
FileSaver: reset state
gtksourceview/gtksourcefilesaver.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gtksourceview/gtksourcefilesaver.c b/gtksourceview/gtksourcefilesaver.c
index 5cd230c..6ecec17 100644
--- a/gtksourceview/gtksourcefilesaver.c
+++ b/gtksourceview/gtksourcefilesaver.c
@@ -215,24 +215,31 @@ gtk_source_file_saver_get_property (GObject *object,
}
static void
+reset (GtkSourceFileSaver *saver)
+{
+ g_clear_object (&saver->priv->task);
+ g_clear_object (&saver->priv->output_stream);
+ g_clear_object (&saver->priv->input_stream);
+ g_clear_object (&saver->priv->info);
+ g_clear_error (&saver->priv->error);
+}
+
+static void
gtk_source_file_saver_dispose (GObject *object)
{
- GtkSourceFileSaverPrivate *priv = GTK_SOURCE_FILE_SAVER (object)->priv;
+ GtkSourceFileSaver *saver = GTK_SOURCE_FILE_SAVER (object);
- if (priv->source_buffer != NULL)
+ reset (saver);
+
+ if (saver->priv->source_buffer != NULL)
{
- g_object_remove_weak_pointer (G_OBJECT (priv->source_buffer),
- (gpointer *)&priv->source_buffer);
+ g_object_remove_weak_pointer (G_OBJECT (saver->priv->source_buffer),
+ (gpointer *)&saver->priv->source_buffer);
- priv->source_buffer = NULL;
+ saver->priv->source_buffer = NULL;
}
- g_clear_object (&priv->file);
- g_clear_object (&priv->output_stream);
- g_clear_object (&priv->input_stream);
- g_clear_object (&priv->task);
- g_clear_object (&priv->info);
- g_clear_error (&priv->error);
+ g_clear_object (&saver->priv->file);
G_OBJECT_CLASS (gtk_source_file_saver_parent_class)->dispose (object);
}
@@ -905,7 +912,7 @@ gtk_source_file_saver_save_finish (GtkSourceFileSaver *saver,
ok = g_task_propagate_boolean (G_TASK (result), error);
- g_clear_object (&saver->priv->task);
+ reset (saver);
return ok;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]