Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tev does not exit when the window is closed #216

Open
alex-fu27 opened this issue Dec 29, 2023 · 4 comments
Open

tev does not exit when the window is closed #216

alex-fu27 opened this issue Dec 29, 2023 · 4 comments

Comments

@alex-fu27
Copy link

I have just been looking for an OpenEXR viewer, tried out tev on NixOS and started it from the shell with a Multilayer EXR image as argument, but when I close the window, the program just stays running until I kill it:

$ tev ./0047.exr 
11:12:50 SUCCESS  Initialized IPC, listening on 127.0.0.1:14158
11:12:50 INFO     Launching with 8 bits of color and LDR display support.
11:12:50 SUCCESS  Loaded /home/alex/uni/masterarbeit/impl/datasets/table/output/./0047.exr via OpenEXR after 0.061 seconds.
^C^C
$ tev --version
tev — The EXR Viewer
version 1.26 (64 bit)
@Tom94
Copy link
Owner

Tom94 commented Dec 29, 2023

Hi, thanks for reporting this. Unfortunately I can’t reproduce it — I routinely use tev on Ubuntu and Arch via the shell (with tiling and regular window managers) and so far have not come across this. I suspect the window-close message from your WM might not make it through GLFW to tev.

If you have extra information, I’d much appreciate it. Like: what WM do you use, do you use x11 or Wayland, does the problem also happen when building from source, what’s your specific OS version, etc.

Also, if someone else watching this repo has run into this in the past, feel free to chime in.

@to-mas-kral
Copy link

to-mas-kral commented Apr 29, 2024

Hi, I've just encountered this as well. Using tev version 1.26dev (64 bit) from AUR.
I use KDE Plasma 6.0.3 with KWin on Wayland.

EDIT: switching to X11 doesn't solve the issue

@alex-fu27
Copy link
Author

I built the Debug configuration and ran tev with gdb. This is the log:
log.txt

If I interpret this correctly, you have this

    // Spawn a background thread that opens images passed via stdin.
    // To allow whitespace characters in filenames, we use the convention that
    // paths in stdin must be separated by newlines.
    thread stdinThread{[&]() {
        string channelSelector;
        while (!shuttingDown()) {
            for (string line; getline(cin, line);) {
                string imageFile = tev::ensureUtf8(line);

                if (imageFile.empty()) {
                    continue;
                }

and if the application is exiting, the getline is blocking until the stdin file is closed, so this thread never dies.

@Tom94
Copy link
Owner

Tom94 commented Apr 30, 2024

Hi, that's a great catch! Right below the code you just linked, the thread is detached, which should not allow it to stall the application

// It is unfortunately not easily possible to poll/timeout on cin in a portable manner,
// so instead we resort to simply detaching this thread, causing it to be forcefully
// terminated as the main thread terminates.
stdinThread.detach();

... but your GDB log indeed seems to say otherwise. Could you try removing the stdinThread variable entirely and let me know whether it resolves the issue? If so, I'll try to come up with an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants