Bugfix: Don’t crash when dock clients set the urgency hint (+testcase)

This commit is contained in:
Michael Stapelberg 2011-05-11 22:45:20 +02:00
parent 4be3178d4d
commit c62f70856f
2 changed files with 64 additions and 1 deletions

View File

@ -813,7 +813,11 @@ static int handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_w
//CLIENT_LOG(con); //CLIENT_LOG(con);
LOG("Urgency flag changed to %d\n", con->urgent); LOG("Urgency flag changed to %d\n", con->urgent);
workspace_update_urgent_flag(con_get_workspace(con)); Con *ws;
/* Set the urgency flag on the workspace, if a workspace could be found
* (for dock clients, that is not the case). */
if ((ws = con_get_workspace(con)) != NULL)
workspace_update_urgent_flag(ws);
tree_render(); tree_render();

View File

@ -0,0 +1,59 @@
#!perl
# vim:ts=4:sw=4:expandtab
#
# Regression test for setting the urgent hint on dock clients.
# found in 4be3178d4d360c2996217d811e61161c84d25898
#
use X11::XCB qw(:all);
use i3test;
BEGIN {
use_ok('X11::XCB::Window');
}
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
my $tmp = fresh_workspace;
#####################################################################
# verify that there is no dock window yet
#####################################################################
# Children of all dockareas
my @docked = get_dock_clients;
is(@docked, 0, 'no dock clients yet');
# open a dock client
my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
);
$window->map;
sleep 0.25;
#####################################################################
# check that we can find it in the layout tree at the expected position
#####################################################################
@docked = get_dock_clients;
is(@docked, 1, 'one dock client found');
# verify the height
my $docknode = $docked[0];
is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
$window->add_hint('urgency');
sleep 0.25;
does_i3_live;
done_testing;