mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
Bug 568394 – dropping the last reference to a stream filter closes the
2009-01-20 Ryan Lortie <desrt@desrt.ca> Bug 568394 – dropping the last reference to a stream filter closes the base stream * gfilterinputstream.h: * gfilterinputstream.c: add "close-base-stream" property and only close the base stream if it is true. issue async close callbacks from correct source object. * gfilteroutputstream.h: * gfilteroutputstream.c: add a "close-base-stream" property and only close the base stream if it is true. issue async close callbacks from correct source object. * gbufferedoutputstream: check g_filter_output_stream_get_close_base() before closing the base stream. fix invalid source tag comparison in close_async (was comparing to flush_async). * ../docs/reference/gio/gio-sections.txt: * gio.symbols: add g_filter_{in,out}put_stream_{g,s}et_close_base_stream * tests/filter-streams.c: new test cases * tests/Makefile.am: add new test * tests/.gitignore: add new test svn path=/trunk/; revision=7825
This commit is contained in:
@@ -508,11 +508,14 @@ g_buffered_output_stream_close (GOutputStream *stream,
|
||||
|
||||
res = flush_buffer (bstream, cancellable, error);
|
||||
|
||||
/* report the first error but still close the stream */
|
||||
if (res)
|
||||
res = g_output_stream_close (base_stream, cancellable, error);
|
||||
else
|
||||
g_output_stream_close (base_stream, cancellable, NULL);
|
||||
if (g_filter_output_stream_get_close_base_stream (G_FILTER_OUTPUT_STREAM (stream)))
|
||||
{
|
||||
/* report the first error but still close the stream */
|
||||
if (res)
|
||||
res = g_output_stream_close (base_stream, cancellable, error);
|
||||
else
|
||||
g_output_stream_close (base_stream, cancellable, NULL);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -569,10 +572,13 @@ flush_buffer_thread (GSimpleAsyncResult *result,
|
||||
/* if flushing the buffer or the stream returned
|
||||
* an error report that first error but still try
|
||||
* close the stream */
|
||||
if (res == FALSE)
|
||||
g_output_stream_close (base_stream, cancellable, NULL);
|
||||
else
|
||||
res = g_output_stream_close (base_stream, cancellable, &error);
|
||||
if (g_filter_output_stream_get_close_base_stream (G_FILTER_OUTPUT_STREAM (stream)))
|
||||
{
|
||||
if (res == FALSE)
|
||||
g_output_stream_close (base_stream, cancellable, NULL);
|
||||
else
|
||||
res = g_output_stream_close (base_stream, cancellable, &error);
|
||||
}
|
||||
}
|
||||
|
||||
if (res == FALSE)
|
||||
@@ -758,7 +764,7 @@ g_buffered_output_stream_close_finish (GOutputStream *stream,
|
||||
simple = G_SIMPLE_ASYNC_RESULT (result);
|
||||
|
||||
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) ==
|
||||
g_buffered_output_stream_flush_async);
|
||||
g_buffered_output_stream_close_async);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user