[mutter/wip/carlosg/incr-is-fubar: 1/2] x11: Do not trust there is task in error paths
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/incr-is-fubar: 1/2] x11: Do not trust there is task in error paths
- Date: Wed, 15 Apr 2020 08:50:17 +0000 (UTC)
commit 1fe379657eedfb1d13e47f799d44a6c661d58d47
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Apr 15 10:46:34 2020 +0200
x11: Do not trust there is task in error paths
Flushing the X11 selection output stream may happen synchronously or
implicitly, in which case there is not a task to complete. Check there
is actually a task before returning errors. We additionally set the
pipe_error flag, so future operations will fail with an error, albeit
with a more generic message.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1198
src/x11/meta-x11-selection-output-stream.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/x11/meta-x11-selection-output-stream.c b/src/x11/meta-x11-selection-output-stream.c
index 3ba05aba0..41a691c9a 100644
--- a/src/x11/meta-x11-selection-output-stream.c
+++ b/src/x11/meta-x11-selection-output-stream.c
@@ -282,13 +282,16 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st
priv->delete_pending = FALSE;
priv->pipe_error = TRUE;
- XGetErrorText (xdisplay, error_code, error_str, sizeof (error_str));
- g_task_return_new_error (priv->pending_task,
- G_IO_ERROR,
- G_IO_ERROR_BROKEN_PIPE,
- "Failed to flush selection output stream: %s",
- error_str);
- g_clear_object (&priv->pending_task);
+ if (priv->pending_task)
+ {
+ XGetErrorText (xdisplay, error_code, error_str, sizeof (error_str));
+ g_task_return_new_error (priv->pending_task,
+ G_IO_ERROR,
+ G_IO_ERROR_BROKEN_PIPE,
+ "Failed to flush selection output stream: %s",
+ error_str);
+ g_clear_object (&priv->pending_task);
+ }
}
else if (priv->pending_task && priv->data->len == 0 && !priv->delete_pending)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]