Fix segfault when calling "i3 -C".
Commit 287a0b4
introduced a segfault when validating the i3 config
as the root_screen will not be set in this case, causing a null
pointer dereference.
fixes #2144
This commit is contained in:
@ -96,8 +96,13 @@ sub activate_i3 {
|
||||
# the interactive signalhandler to make it crash immediately instead.
|
||||
# Also disable logging to SHM since we redirect the logs anyways.
|
||||
# Force Xinerama because we use Xdmx for multi-monitor tests.
|
||||
my $i3cmd = abs_path("../i3") . q| -V -d all --disable-signalhandler| .
|
||||
q| --shmlog-size=0 --force-xinerama|;
|
||||
my $i3cmd = abs_path("../i3") . q| --shmlog-size=0 --disable-signalhandler --force-xinerama|;
|
||||
if (!$args{validate_config}) {
|
||||
# We only set logging if i3 is actually started, but not if we only
|
||||
# validate the config file. This is to keep logging to a minimum as
|
||||
# such a test will likely want to inspect the log file.
|
||||
$i3cmd .= q| -V -d all|;
|
||||
}
|
||||
|
||||
# For convenience:
|
||||
my $outdir = $args{outdir};
|
||||
@ -107,6 +112,10 @@ sub activate_i3 {
|
||||
$i3cmd .= ' -L ' . abs_path('restart-state.golden');
|
||||
}
|
||||
|
||||
if ($args{validate_config}) {
|
||||
$i3cmd .= ' -C';
|
||||
}
|
||||
|
||||
if ($args{valgrind}) {
|
||||
$i3cmd =
|
||||
qq|valgrind --log-file="$outdir/valgrind-for-$test.log" | .
|
||||
@ -149,6 +158,11 @@ sub activate_i3 {
|
||||
# descriptor on the listening socket.
|
||||
$socket->close;
|
||||
|
||||
if ($args{validate_config}) {
|
||||
$args{cv}->send(1);
|
||||
return $pid;
|
||||
}
|
||||
|
||||
# We now connect (will succeed immediately) and send a request afterwards.
|
||||
# As soon as the reply is there, i3 is considered ready.
|
||||
my $cl = IO::Socket::UNIX->new(Peer => $args{unix_socket_path});
|
||||
|
Reference in New Issue
Block a user