summaryrefslogtreecommitdiffstats
path: root/gio/gio.override
diff options
context:
space:
mode:
authorPaul Pogonyshev <pogonyshev@gmx.net>2008-12-21 16:08:01 +0000
committerPaul Pogonyshev <paulp@src.gnome.org>2008-12-21 16:08:01 +0000
commita1b44acabfbca2fd6931699a9407fe8f9d95d253 (patch)
tree34ee13f3903add4b34ee9499cf1d05d7e0e9f620 /gio/gio.override
parent95886775af564a05aaaf5708f0b37279f82d0d76 (diff)
downloadpygobject-a1b44acabfbca2fd6931699a9407fe8f9d95d253.tar.gz
pygobject-a1b44acabfbca2fd6931699a9407fe8f9d95d253.tar.xz
pygobject-a1b44acabfbca2fd6931699a9407fe8f9d95d253.zip
Merge from 2.16 branch:
2008-12-21 Paul Pogonyshev <pogonyshev@gmx.net> Bug 564102 – _wrap_g_output_stream_write_async not adding a reference to the buffer passed * gio/gio.override (pygio_notify_copy_buffer): New function. (pygio_free_notify): Free new `buffer' field if it is set. * gio/goutputstream.override (_wrap_g_output_stream_write_async): Copy the buffer with new pygio_notify_copy_buffer() and use the copy for g_output_stream_write_async() call. * gio/gfile.override (_wrap_g_file_replace_contents_async): Same as for _wrap_g_output_stream_write_async(). svn path=/trunk/; revision=981
Diffstat (limited to 'gio/gio.override')
-rw-r--r--gio/gio.override14
1 files changed, 14 insertions, 0 deletions
diff --git a/gio/gio.override b/gio/gio.override
index e6916a0..0f6ae5f 100644
--- a/gio/gio.override
+++ b/gio/gio.override
@@ -36,6 +36,8 @@ headers
typedef struct {
PyObject *callback;
PyObject *data;
+ gpointer buffer;
+ gsize buffer_size;
} PyGIONotify;
static void
@@ -45,10 +47,22 @@ py_decref_callback (gpointer data)
}
static void
+pygio_notify_copy_buffer(PyGIONotify *notify, gpointer buffer, gsize buffer_size)
+{
+ if (buffer_size > 0) {
+ notify->buffer = g_slice_copy(buffer_size, buffer);
+ notify->buffer_size = buffer_size;
+ }
+}
+
+static void
pygio_free_notify(PyGIONotify *notify)
{
Py_XDECREF(notify->callback);
Py_XDECREF(notify->data);
+ if (notify->buffer)
+ g_slice_free1(notify->buffer_size, notify->buffer);
+
g_slice_free(PyGIONotify, notify);
}