Fix segfault with mode "default" key bindings (#5007)
ignore bindings when not in a valid mode Co-authored-by: Ivan Zharov <zhiv.email@gmail.com> Co-authored-by: Michael Stapelberg <stapelberg@users.noreply.github.com>
This commit is contained in:
parent
f795c2c8da
commit
e48b9aa284
1
release-notes/bugfixes/8-mode-default-sigsegv
Normal file
1
release-notes/bugfixes/8-mode-default-sigsegv
Normal file
@ -0,0 +1 @@
|
||||
Fix segfault with explicit mode "default" key bindings.
|
@ -180,6 +180,11 @@ static char *current_mode;
|
||||
static bool current_mode_pango_markup;
|
||||
|
||||
CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *exclude_titlebar, const char *command) {
|
||||
if (current_mode == NULL) {
|
||||
/* When using an invalid mode name, e.g. “default” */
|
||||
return;
|
||||
}
|
||||
|
||||
configure_binding(bindtype, modifiers, key, release, border, whole_window, exclude_titlebar, command, current_mode, current_mode_pango_markup);
|
||||
}
|
||||
|
||||
|
34
testcases/t/547-explicit-mode-default.t
Normal file
34
testcases/t/547-explicit-mode-default.t
Normal file
@ -0,0 +1,34 @@
|
||||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
#
|
||||
# Please read the following documents before working on tests:
|
||||
# • https://build.i3wm.org/docs/testsuite.html
|
||||
# (or docs/testsuite)
|
||||
#
|
||||
# • https://build.i3wm.org/docs/lib-i3test.html
|
||||
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
||||
#
|
||||
# • https://build.i3wm.org/docs/ipc.html
|
||||
# (or docs/ipc)
|
||||
#
|
||||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||
# (unless you are already familiar with Perl)
|
||||
#
|
||||
# Test that explicitly defined default mode doesn't cause segfault.
|
||||
# Ticket: #5006
|
||||
# Bug still in: 4.20-96-gce2665ca
|
||||
|
||||
use i3test i3_autostart => 0;
|
||||
|
||||
my $config = <<EOT;
|
||||
# i3 config file (v4)
|
||||
mode "default" {
|
||||
bindsym X resize
|
||||
}
|
||||
EOT
|
||||
|
||||
my $pid = launch_with_config($config);
|
||||
does_i3_live;
|
||||
|
||||
exit_gracefully($pid);
|
||||
done_testing;
|
Loading…
x
Reference in New Issue
Block a user