mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
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
This commit is contained in:
parent
c97a758aa7
commit
9962ef9ac4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user