mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-15 20:18:05 +02:00
Check that close_fn is not %NULL before calling (#578499)
Some streams have no close function, so this caused a crash.
This commit is contained in:
parent
0a280dadec
commit
c20b8d4d53
@ -1167,6 +1167,8 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
open handles */
|
||||
|
||||
class = G_INPUT_STREAM_GET_CLASS (object);
|
||||
if (class->close_fn)
|
||||
{
|
||||
result = class->close_fn (G_INPUT_STREAM (object), cancellable, &error);
|
||||
if (!result)
|
||||
{
|
||||
@ -1174,6 +1176,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_input_stream_real_close_async (GInputStream *stream,
|
||||
|
@ -569,6 +569,8 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
open handles */
|
||||
|
||||
class = G_IO_STREAM_GET_CLASS (object);
|
||||
if (class->close_fn)
|
||||
{
|
||||
result = class->close_fn (G_IO_STREAM (object), cancellable, &error);
|
||||
if (!result)
|
||||
{
|
||||
@ -576,6 +578,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_io_stream_real_close_async (GIOStream *stream,
|
||||
|
@ -456,7 +456,8 @@ g_output_stream_real_splice (GOutputStream *stream,
|
||||
if (flags & G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET)
|
||||
{
|
||||
/* But write errors on close are bad! */
|
||||
if (!class->close_fn (stream, cancellable, error))
|
||||
if (class->close_fn &&
|
||||
!class->close_fn (stream, cancellable, error))
|
||||
res = FALSE;
|
||||
}
|
||||
|
||||
@ -1309,6 +1310,8 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
open handles */
|
||||
|
||||
class = G_OUTPUT_STREAM_GET_CLASS (object);
|
||||
if (class->close_fn)
|
||||
{
|
||||
result = class->close_fn (G_OUTPUT_STREAM (object), cancellable, &error);
|
||||
if (!result)
|
||||
{
|
||||
@ -1316,6 +1319,7 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_output_stream_real_close_async (GOutputStream *stream,
|
||||
|
Loading…
x
Reference in New Issue
Block a user