[anjuta] sourceview: only update stored etag if save was succesful
- From: Carl-Anton Ingmarsson <carlantoni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] sourceview: only update stored etag if save was succesful
- Date: Tue, 19 Feb 2013 22:57:44 +0000 (UTC)
commit 392d34787e5fe3f3e9a0f2814006eab392c8182f
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Tue Feb 19 23:51:36 2013 +0100
sourceview: only update stored etag if save was succesful
previously we would always free the previous etag even though the replace
was not succesful. This would cause the etag to point to invalid memory in
the non succesful case.
plugins/sourceview/sourceview-io.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/plugins/sourceview/sourceview-io.c b/plugins/sourceview/sourceview-io.c
index 6ccdcab..19e10b3 100644
--- a/plugins/sourceview/sourceview-io.c
+++ b/plugins/sourceview/sourceview-io.c
@@ -246,11 +246,11 @@ on_save_finished (GObject* file, GAsyncResult* result, gpointer data)
SourceviewIO* sio = SOURCEVIEW_IO(data);
AnjutaShell* shell = ANJUTA_PLUGIN (sio->sv->priv->plugin)->shell;
GError* err = NULL;
+ gchar* etag;
- g_free (sio->etag);
g_file_replace_contents_finish (G_FILE (file),
result,
- &sio->etag,
+ &etag,
&err);
g_free (sio->write_buffer);
sio->write_buffer = NULL;
@@ -264,6 +264,10 @@ on_save_finished (GObject* file, GAsyncResult* result, gpointer data)
set_display_name (sio);
if (!sio->monitor)
setup_monitor (sio);
+
+ g_free (sio->etag);
+ sio->etag = etag;
+
g_signal_emit_by_name (sio, "save-finished");
}
g_object_unref (sio);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]