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>
print_backtrace();
- segv_compositor->backend->restore(segv_compositor);
+ if (segv_compositor && segv_compositor->backend)
+ segv_compositor->backend->restore(segv_compositor);
raise(SIGTRAP);
}
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"
weston_log("fatal: failed to create compositor\n");
goto out;
}
+ segv_compositor = ec;
if (weston_compositor_init_config(ec, config) < 0)
goto out;
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)