weston: arm SEGV handler earlier
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@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
409b01fd6d
commit
3baf9ce7e8
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user