i3 / i3

A tiling window manager for X11
https://i3wm.org/
BSD 3-Clause "New" or "Revised" License
9.5k stars 780 forks source link

Restoring windows under fullscreen results in empty "nowin" windows #3731

Open chrysn opened 5 years ago

chrysn commented 5 years ago

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

When screens are captured using i3-save-tree where a window is full-screen, all windows on that screen but the full-screen ones lack visible names. They show as "nowin" rather than "noinstance" in the title bars of outside containers in stacking mode (eg. "V[V[S[noinstance] S[nowin]]]"), and don't render title bars of their own at all if they are direct children of stacking mode. Rather than showing black with a question mark and the capture criteria, it doesn't paint anything. When that nowin window gets save-tree'd, it turns up with an empty "swallow" section.

The swallowing window still swallows as it should.

Expected Behavior

The window under the full-screen should behave just like other restored windows, especially by showing its capture criteria and painting something in the first place.

Reproduction Instructions

Save outputs (edited for applicability by removing the comments) for fullscreen and non-fullscreen cases are attached and can be tested by i3-msg "workspace 3; append_layout /tmp/full". After running, change to workspace 3, select the fullscren window, unfullscreen it and look at how the other window shows the background image.

Environment

Output of i3 --moreversion 2>&-:

Binary i3 version:  4.16.1 (2019-01-27) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.16.1 (2019-01-27) (pid 3936)abort…)
Loaded i3 config: /home/chrysn/.config/i3/config (Last modified: Fri 01 Mar 2019 17:59:57 CET, 11111982 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

Reproduced with an empty config file (generated at the launch prompt with Alt as modifier key).

- Linux Distribution & Version: Debian sid
- Are you using a compositor (e.g., xcompmgr or compton): not usually (but behavior is the same when xcompmgr is running)
chrysn commented 5 years ago

A log from a reproduction run is at https://logs.i3wm.org/logs/5767082058711040.bz2 -- doesn't look to me as if it contained anything helpful, though.

orestisfl commented 5 years ago

eg this layout crashes i3 if a matching:

// vim:ts=4:sw=4:et
{
    "border": "normal",
    "current_border_width": 5,
    "floating": "auto_off",
    "fullscreen_mode": 1,
    "geometry": {
       "height": 316,
       "width": 484,
       "x": 0,
       "y": 0
    },
    "name": "SomeName",
    "percent": 0.5,
    "swallows": [
       {
       "class": "^URxvt$"
       }
    ],
    "type": "con"
}

{
    "border": "normal",
    "current_border_width": 5,
    "floating": "auto_off",
    "geometry": {
       "height": 316,
       "width": 484,
       "x": 0,
       "y": 0
    },
    "name": "SomeOtherName",
    "percent": 0.5,
    "swallows": [
       {
       "class": "^URxvt$"
       }
    ],
    "type": "con"
}

If you un-fullscreen "SomeName" you'll see that "SomeOtherName" is not rendered properly.

orestisfl commented 5 years ago

@stapelberg I don't understand placeholder code very well, maybe you can see what's wrong here. Backtrace:

#0  0x00007fd0d9c8c21a in waitpid () at /usr/lib/libpthread.so.0
#1  0x00007fd0db7682d0 in __interceptor_waitpid(int, int*, int) (pid=<optimized out>, status=0x7fff8eeb33e0, options=<optimized out>) at /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2382
        res = <optimized out>
#2  0x0000558b5d778fe0 in sighandler_backtrace () at ../../i3/src/sighandler.c:126
        tmpdir = 0x7fff8eeb5849 "/tmp/orestis"
        pid_parent = 2214559
        filename = 0x6040000528d0 "/tmp/orestis/i3-backtrace.2214559.1.txt"
        suffix = 2
        pid_gdb = 2220698
        __FUNCTION__ = "sighandler_backtrace"
        status = 0
#3  0x0000558b5d77c3a0 in sighandler_handle_key_press (event=0x604000052850) at ../../i3/src/sighandler.c:291
        state = 0
        sym = 98
        __FUNCTION__ = "sighandler_handle_key_press"
#4  0x0000558b5d77c614 in handle_signal (sig=11, info=0x7fff8eeb3870, data=0x7fff8eeb3740) at ../../i3/src/sighandler.c:322
        type = 2
        __FUNCTION__ = "handle_signal"
        action = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0 <repeats 16 times>}}, sa_flags = 0, sa_restorer = 0x726520656d69746e}
        event = 0x604000052850
#5  0x00007fd0d9c8c930 in <signal handler called> () at /usr/lib/libpthread.so.0
#6  0x0000558b5d74188e in remanage_window (con=0x614000010240) at ../../i3/src/manage.c:708
        match = Python Exception <class 'gdb.MemoryError'> Cannot access memory at address 0xffffffffffffffc0: 
#7  0x0000558b5d700c2b in handle_windowname_change_legacy (data=0x0, conn=0x62a000000200, state=0 '\000', window=2097209, atom=39, prop=0x604000051890) at ../../i3/src/handlers.c:597
        con = 0x614000010240
        old_name = 0x6020000d5ff0 "urxvt"
#8  0x0000558b5d709ff6 in property_notify (state=0 '\000', window=2097209, atom=39) at ../../i3/src/handlers.c:1347
        handler = 0x558b5d9bb100 <property_handlers+32>
        propr = 0x604000051890
#9  0x0000558b5d70b590 in handle_event (type=28, event=0x604000051790) at ../../i3/src/handlers.c:1488
        e = 0x604000051790
        __FUNCTION__ = "handle_event"
#10 0x0000558b5d72a3d4 in xcb_prepare_cb (loop=0x7fd0da768720, w=0x60300005bcf0, revents=16384) at ../../i3/src/main.c:132
        type = 28
        event = 0x604000051790
        __FUNCTION__ = "xcb_prepare_cb"
#11 0x00007fd0da75cdc3 in ev_invoke_pending () at /usr/lib/libev.so.4
#12 0x00007fd0da760a0c in ev_run () at /usr/lib/libev.so.4
#13 0x0000558b5d72a014 in ev_loop (loop=0x7fd0da768720, flags=0) at /usr/include/ev.h:837
#14 0x0000558b5d737cd8 in main (argc=4, argv=0x7fff8eeb4a88) at ../../i3/src/main.c:1023
        _i3_version = 0x558b5d82a040 "4.17-214-g879fd6c0 (2019-10-17, branch \"next\")"
        override_configpath = 0x602000000ef0 "/tmp/i3.config"
        autostart = true
        layout_path = 0x0
        delete_layout_path = false
        disable_randr15 = false
        fake_outputs = 0x0
        disable_signalhandler = false
        only_check_config = false
        long_options = {{name = 0x558b5d829e00 "no-autostart", has_arg = 0, flag = 0x0, val = 97}, {name = 0x558b5d829e40 "config", has_arg = 1, flag = 0x0, val = 99}, {name = 0x558b5d829e80 "version", has_arg = 0, flag = 0x0, val = 118}, {name = 0x558b5d829ec0 "moreversion", has_arg = 0, flag = 0x0, val = 109}, {name = 0x558b5d829f00 "more-version", has_arg = 0, flag = 0x0, val = 109}, {name = 0x558b5d829f40 "more_version", has_arg = 0, flag = 0x0, val = 109}, {name = 0x558b5d829f80 "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x558b5d829fc0 "layout", has_arg = 1, flag = 0x0, val = 76}, {name = 0x558b5d825f80 "restart", has_arg = 1, flag = 0x0, val = 0}, {name = 0x558b5d825b60 "force-xinerama", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d825ba0 "force_xinerama", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d825d20 "disable-randr15", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d825d60 "disable_randr15", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d825da0 "disable-signalhandler", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d825ea0 "shmlog-size", has_arg = 1, flag = 0x0, val = 0}, {name = 0x558b5d825ee0 "shmlog_size", has_arg = 1, flag = 0x0, val = 0}, {name = 0x558b5d825de0 "get-socketpath", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d825e20 "get_socketpath", has_arg = 0, flag = 0x0, val = 0}, {name = 0x558b5d826000 "fake_outputs", has_arg = 1, flag = 0x0, val = 0}, {name = 0x558b5d825fc0 "fake-outputs", has_arg = 1, flag = 0x0, val = 0}, {name = 0x558b5d826080 "force-old-config-parser-v4.4-only", has_arg = 0, flag = 0x0, val = 0}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
        option_index = 0
        opt = -1
        __FUNCTION__ = "main"
        _NET_SUPPORTED_cookie = {sequence = 5}
        _NET_SUPPORTING_WM_CHECK_cookie = {sequence = 6}
        _NET_WM_NAME_cookie = {sequence = 7}
        _NET_WM_VISIBLE_NAME_cookie = {sequence = 8}
        _NET_WM_MOVERESIZE_cookie = {sequence = 9}
        _NET_WM_STATE_STICKY_cookie = {sequence = 10}
        _NET_WM_STATE_FULLSCREEN_cookie = {sequence = 11}
        _NET_WM_STATE_DEMANDS_ATTENTION_cookie = {sequence = 12}
        _NET_WM_STATE_MODAL_cookie = {sequence = 13}
        _NET_WM_STATE_HIDDEN_cookie = {sequence = 14}
        _NET_WM_STATE_FOCUSED_cookie = {sequence = 15}
        _NET_WM_STATE_cookie = {sequence = 16}
        _NET_WM_WINDOW_TYPE_cookie = {sequence = 17}
        _NET_WM_WINDOW_TYPE_NORMAL_cookie = {sequence = 18}
        _NET_WM_WINDOW_TYPE_DOCK_cookie = {sequence = 19}
        _NET_WM_WINDOW_TYPE_DIALOG_cookie = {sequence = 20}
        _NET_WM_WINDOW_TYPE_UTILITY_cookie = {sequence = 21}
        _NET_WM_WINDOW_TYPE_TOOLBAR_cookie = {sequence = 22}
        _NET_WM_WINDOW_TYPE_SPLASH_cookie = {sequence = 23}
        _NET_WM_WINDOW_TYPE_MENU_cookie = {sequence = 24}
        _NET_WM_WINDOW_TYPE_DROPDOWN_MENU_cookie = {sequence = 25}
        _NET_WM_WINDOW_TYPE_POPUP_MENU_cookie = {sequence = 26}
        _NET_WM_WINDOW_TYPE_TOOLTIP_cookie = {sequence = 27}
        _NET_WM_WINDOW_TYPE_NOTIFICATION_cookie = {sequence = 28}
        _NET_WM_DESKTOP_cookie = {sequence = 29}
        _NET_WM_STRUT_PARTIAL_cookie = {sequence = 30}
        _NET_CLIENT_LIST_cookie = {sequence = 31}
        _NET_CLIENT_LIST_STACKING_cookie = {sequence = 32}
        _NET_CURRENT_DESKTOP_cookie = {sequence = 33}
        _NET_NUMBER_OF_DESKTOPS_cookie = {sequence = 34}
        _NET_DESKTOP_NAMES_cookie = {sequence = 35}
        _NET_DESKTOP_VIEWPORT_cookie = {sequence = 36}
        _NET_ACTIVE_WINDOW_cookie = {sequence = 37}
        _NET_CLOSE_WINDOW_cookie = {sequence = 38}
        _NET_MOVERESIZE_WINDOW_cookie = {sequence = 39}
        _NET_WM_USER_TIME_cookie = {sequence = 40}
        _NET_STARTUP_ID_cookie = {sequence = 41}
        _NET_WORKAREA_cookie = {sequence = 42}
        WM_PROTOCOLS_cookie = {sequence = 43}
        WM_DELETE_WINDOW_cookie = {sequence = 44}
        UTF8_STRING_cookie = {sequence = 45}
        WM_STATE_cookie = {sequence = 46}
        WM_CLIENT_LEADER_cookie = {sequence = 47}
        WM_TAKE_FOCUS_cookie = {sequence = 48}
        WM_WINDOW_ROLE_cookie = {sequence = 49}
        I3_SOCKET_PATH_cookie = {sequence = 50}
        I3_CONFIG_PATH_cookie = {sequence = 51}
        I3_SYNC_cookie = {sequence = 52}
        I3_SHMLOG_PATH_cookie = {sequence = 53}
        I3_PID_cookie = {sequence = 54}
        I3_FLOATING_WINDOW_cookie = {sequence = 55}
        _NET_REQUEST_FRAME_EXTENTS_cookie = {sequence = 56}
        _NET_FRAME_EXTENTS_cookie = {sequence = 57}
        _MOTIF_WM_HINTS_cookie = {sequence = 58}
        WM_CHANGE_STATE_cookie = {sequence = 59}
        gcookie = {sequence = 63}
        pointercookie = {sequence = 64}
        cookie = {sequence = 75}
        error = 0x0
        greply = 0x6030000071b0
        extreply = 0x60300004cf60
        needs_tree_init = true
        pointerreply = 0x603000007210
        output = 0x606000012ec0
        ipc_socket = 9
        xcb_watcher = 0x604000021650
        barconfig = 0x0
A debugging session is active.

    Inferior 1 [process 2214559] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (process 2214559) detached]
stapelberg commented 5 years ago

line 708 is https://github.com/i3/i3/blob/879fd6c08bc890e33b241715423d418788a4410b/src/manage.c#L708, so my guess is that either nc->window is NULL or con->window is NULL. Can you check with gdb?

orestisfl commented 5 years ago

nc->window is NULL, sorry for not mentioning that earlier. Returning on that condition at least fixes the crash (and somehow the placeholder windows end up closing) but the behavior is still very weird.

I recorded it for your convenience: https://streamable.com/jg4np / https://gfycat.com/acrobaticspeedyeastsiberianlaika

stapelberg commented 5 years ago

Sorry, it’s not obvious to me what’s wrong here, and I don’t have time to look into this anytime soon.