[gtk/wip/otte/for-master] broadway: fix texture upload
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master] broadway: fix texture upload
- Date: Thu, 28 Oct 2021 12:50:05 +0000 (UTC)
commit 9962ef9ac44a405df17d73bf959be73076e5603d
Author: Benjamin Otte <otte redhat com>
Date: Thu Oct 28 14:48:20 2021 +0200
broadway: fix texture upload
This was carelessly broken by me in 5b473911.
While fixing it anyway, at some support for better error handling.
Fixes #4381
gdk/broadway/gdkbroadway-server.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index 4ce17727cd..bd221f5442 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -620,21 +620,28 @@ gdk_broadway_server_upload_texture (GdkBroadwayServer *server,
gsize size;
int fd;
- id = server->next_texture_id++;
-
bytes = gdk_texture_save_to_png_bytes (texture);
fd = open_shared_memory ();
data = g_bytes_get_data (bytes, &size);
- while (size)
+ id = server->next_texture_id++;
+
+ msg.id = id;
+ msg.offset = 0;
+ msg.size = 0;
+
+ while (msg.size < size)
{
- gssize ret = write (fd, data, size);
+ gssize ret = write (fd, data + msg.size, size - msg.size);
if (ret <= 0)
- break;
+ {
+ if (errno == EINTR)
+ continue;
+ break;
+ }
- size -= ret;
- data += ret;
+ msg.size += ret;
}
g_bytes_unref (bytes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]