[PATCH weston v3 01/36] weston: arm SEGV handler earlier
Pekka Paalanen
ppaalanen at gmail.com
Tue Oct 31 11:48:11 UTC 2017
From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
It is useful to print the backtrace regardless of whether we have a
compositor and a backend initialized yet. Move catch_signals() to the
earliest point in main() and protect the SEGV handler from dereferencing
NULL when we don't yet have a compositor or a backend.
The SEGV handler uses weston_log(), so cannot move catch_signals() any
earlier.
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
compositor/main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/compositor/main.c b/compositor/main.c
index 9e4451e5..9f00ee3a 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -656,7 +656,8 @@ on_caught_signal(int s, siginfo_t *siginfo, void *context)
print_backtrace();
- segv_compositor->backend->restore(segv_compositor);
+ if (segv_compositor && segv_compositor->backend)
+ segv_compositor->backend->restore(segv_compositor);
raise(SIGTRAP);
}
@@ -1824,6 +1825,8 @@ int main(int argc, char *argv[])
weston_log_set_handler(vlog, vlog_continue);
weston_log_file_open(log);
+ catch_signals();
+
weston_log("%s\n"
STAMP_SPACE "%s\n"
STAMP_SPACE "Bug reports to: %s\n"
@@ -1872,6 +1875,7 @@ int main(int argc, char *argv[])
weston_log("fatal: failed to create compositor\n");
goto out;
}
+ segv_compositor = ec;
if (weston_compositor_init_config(ec, config) < 0)
goto out;
@@ -1887,9 +1891,6 @@ int main(int argc, char *argv[])
weston_pending_output_coldplug(ec);
- catch_signals();
- segv_compositor = ec;
-
if (idle_time < 0)
weston_config_section_get_int(section, "idle-time", &idle_time, -1);
if (idle_time < 0)
--
2.13.6
More information about the wayland-devel
mailing list