[gtk/async-highlight] Fix a lockup problem
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/async-highlight] Fix a lockup problem
- Date: Thu, 13 Aug 2020 15:50:00 +0000 (UTC)
commit e323ca3273e28de5dc4ce010b20fd09de6a6e8d1
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 13 11:49:41 2020 -0400
Fix a lockup problem
demos/gtk-demo/main.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 49502e1ab2..89222e179b 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -8,6 +8,9 @@
#include <gtk/gtk.h>
#include <glib/gstdio.h>
+#include <gio/gunixoutputstream.h>
+#include <fcntl.h>
+
#include "demos.h"
static GtkWidget *info_view;
@@ -363,6 +366,14 @@ fontify (const char *format,
return;
}
+ /* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
+ if (G_IS_UNIX_OUTPUT_STREAM (g_subprocess_get_stdin_pipe (subprocess)))
+ {
+ GOutputStream *stdin_pipe = g_subprocess_get_stdin_pipe (subprocess);
+ int fd = g_unix_output_stream_get_fd (G_UNIX_OUTPUT_STREAM (stdin_pipe));
+ fcntl (fd, F_SETFL, O_NONBLOCK);
+ }
+
g_subprocess_communicate_async (subprocess,
stdin_buf,
NULL,
@@ -761,7 +772,7 @@ load_file (const char *demoname,
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
bytes = g_bytes_new_static (text, strlen (text));
- fontify ("c", source_buffer, bytes);
+ //fontify ("c", source_buffer, bytes);
g_bytes_unref (bytes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]