From 3a9434706cd1efb28407683fee89079b4bf09ba2 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Mon, 2 Nov 2020 17:07:47 +0200 Subject: gst-shm: Convert return to exit() 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 Change-Id: I6270177572f850214b00f7ef204564af35a7a09e --- src/wth-receiver-gst-shm.c | 31 ++++++++++++++++++++++++++++--- 1 file 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); -- cgit 1.2.3-korg