aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-11-02 17:07:47 +0200
committerMarius Vlad <marius.vlad@collabora.com>2020-11-18 14:13:21 +0200
commit3a9434706cd1efb28407683fee89079b4bf09ba2 (patch)
tree1f5eac3b03d25eb450cf9f35126bbf8c6b0d353d
parente0ef63211a451b9f8d9f5dd29f5579074ca0b4e0 (diff)
gst-shm: Convert return to exit()sandbox/mvlad/waltham-remoting
As we're running in a child process, substitute returns with exits to signal the parent correctly. Bug-AGL: SPEC-3675 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I6270177572f850214b00f7ef204564af35a7a09e
-rw-r--r--src/wth-receiver-gst-shm.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/wth-receiver-gst-shm.c b/src/wth-receiver-gst-shm.c
index 50efe0b..be21f6c 100644
--- a/src/wth-receiver-gst-shm.c
+++ b/src/wth-receiver-gst-shm.c
@@ -417,6 +417,24 @@ static const struct wl_callback_listener frame_listener = {
redraw
};
+static struct client *to_client(struct surface *surface)
+{
+ struct ivisurface *ivisurface = NULL;
+ struct client *client = NULL;
+
+ if (!surface)
+ return NULL;
+
+ if (!surface->ivisurf)
+ return NULL;
+
+ ivisurface = surface->ivisurf;
+ if (!ivisurface->appid)
+ return client;
+
+ return ivisurface->appid->client;
+}
+
static void
redraw(void *data, struct wl_callback *callback, uint32_t time)
{
@@ -425,10 +443,12 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
buffer = get_next_buffer(window);
if (!buffer) {
+ struct client *client = to_client(window->receiver_surf);
fprintf(stderr,
!callback ? "Failed to create the first buffer.\n" :
"Both buffers busy at redraw(). Server bug?\n");
- abort();
+ client->pid_destroying = true;
+ exit(EXIT_FAILURE);
}
// do the actual painting
@@ -658,7 +678,7 @@ create_display(void)
display = malloc(sizeof *display);
if (display == NULL) {
wth_error("out of memory\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
display->display = wl_display_connect(NULL);
assert(display->display);
@@ -819,8 +839,13 @@ wth_receiver_weston_main(struct window *window, const char *app_id, int port)
/* parse the pipeline */
gstctx.pipeline = gst_parse_launch(pipeline, &gerror);
- if (!gstctx.pipeline)
+ if (!gstctx.pipeline) {
+ struct client *client = to_client(window->receiver_surf);
+
fprintf(stderr, "Could not create gstreamer pipeline.\n");
+ client->pid_destroying = true;
+ exit(EXIT_FAILURE);
+ }
gstctx.bus = gst_element_get_bus(gstctx.pipeline);
gst_bus_add_signal_watch(gstctx.bus);