From: Michael Stapelberg Date: Wed, 11 May 2011 20:45:20 +0000 (+0200) Subject: Bugfix: Don’t crash when dock clients set the urgency hint (+testcase) X-Git-Tag: tree-pr3~41 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c62f70856f04e6053bb57b39e3bb82e52fb95955;p=i3%2Fi3 Bugfix: Don’t crash when dock clients set the urgency hint (+testcase) --- diff --git a/src/handlers.c b/src/handlers.c index 2f954823..589b81f6 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -813,7 +813,11 @@ static int handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_w //CLIENT_LOG(con); 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(); diff --git a/testcases/t/62-regress-dock-urgent.t b/testcases/t/62-regress-dock-urgent.t new file mode 100644 index 00000000..78bf3e80 --- /dev/null +++ b/testcases/t/62-regress-dock-urgent.t @@ -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;