summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2024-04-18 15:02:56 +0300
committerMarius Vlad <marius.vlad@collabora.com>2024-04-20 17:15:33 +0300
commitd2510f1e79e501a8e6aecb8058746a7456d1367e (patch)
tree695f34080d8a8eefcbb15083a61bbbcb13ba7757
parent8e20d1cb7626dc6cb5b7fbd61714d4ed76d0e1e9 (diff)
compositor: Fix wet_process cleanup on compositor shuwdown
Bug-AGL: PEC-5104 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ib57d93378847cf2c7fa07782d983a179fa4a7ce8
-rw-r--r--src/compositor.c14
-rw-r--r--src/ivi-compositor.h4
-rw-r--r--src/xwayland.c12
3 files changed, 19 insertions, 11 deletions
diff --git a/src/compositor.c b/src/compositor.c
index d82676b..1881702 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -73,6 +73,16 @@ to_ivi_compositor(struct weston_compositor *ec)
return weston_compositor_get_user_data(ec);
}
+void
+ivi_process_destroy(struct wet_process *process, int status, bool call_cleanup)
+{
+ wl_list_remove(&process->link);
+ if (call_cleanup && process->cleanup)
+ process->cleanup(process, status, process->cleanup_data);
+ free(process->path);
+ free(process);
+}
+
struct ivi_output_config *
ivi_init_parsed_options(struct weston_compositor *compositor)
{
@@ -2034,6 +2044,7 @@ int wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_da
bool xwayland = false;
struct sigaction action;
char *renderer = NULL;
+ struct wet_process *process, *process_tmp;
const struct weston_option core_options[] = {
{ WESTON_OPTION_STRING, "renderer", 'r', &renderer },
@@ -2252,6 +2263,9 @@ error_compositor:
ivi_policy_destroy(ivi.policy);
+ wl_list_for_each_safe(process, process_tmp, &ivi.child_process_list, link)
+ ivi_process_destroy(process, 0, false);
+
error_signals:
for (size_t i = 0; i < ARRAY_LENGTH(signals); ++i)
if (signals[i])
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h
index 7afb0c9..1303e44 100644
--- a/src/ivi-compositor.h
+++ b/src/ivi-compositor.h
@@ -29,6 +29,7 @@
#include <stdbool.h>
#include "config.h"
+#include <weston.h>
#include <libweston/backend-drm.h>
#include <libweston/libweston.h>
#include <libweston/windowed-output-api.h>
@@ -566,4 +567,7 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *out
struct ivi_output_config *
ivi_init_parsed_options(struct weston_compositor *compositor);
+void
+ivi_process_destroy(struct wet_process *process, int status, bool call_cleanup);
+
#endif
diff --git a/src/xwayland.c b/src/xwayland.c
index 229ce75..3bea411 100644
--- a/src/xwayland.c
+++ b/src/xwayland.c
@@ -55,16 +55,6 @@ struct wet_xwayland {
struct wet_process *process;
};
-static void
-process_destroy(struct wet_process *process, int status, bool call_cleanup)
-{
- wl_list_remove(&process->link);
- if (call_cleanup && process->cleanup)
- process->cleanup(process, status, process->cleanup_data);
- free(process->path);
- free(process);
-}
-
static int
handle_display_fd(int fd, uint32_t mask, void *data)
{
@@ -337,7 +327,7 @@ wet_xwayland_destroy(struct weston_compositor *compositor, void *data)
/* Calling this will call the process cleanup, in turn cleaning up the
* client and the core Xwayland state */
if (wxw->process)
- process_destroy(wxw->process, 0, true);
+ ivi_process_destroy(wxw->process, 0, true);
free(wxw);
}