Skip to content

Fix crash at startup on terminal resize #469

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

Merged
merged 2 commits into from
Feb 18, 2025
Merged

Conversation

zcsahok
Copy link
Member

@zcsahok zcsahok commented Feb 16, 2025

To reproduce the issue

  1. start TLF in a resizable terminal with size smaller than 22x80
  2. at the "Continue anyway?" prompt resize the terminal
  3. get a segfault
    image

The issue is caused by resize_layout() trying to access not yet initialized variables (rst arrays).

Solved by introducing variable tlf_initialized that is set to true only when all has been set up, just before calling logit().
While tlf_initialized is false, resizing now just stores the terminal size.

A related issue has also popped up: resizing "keypress" is treated as an actual one, causing misfunction at some "Y/N" or "press any key" prompts.
Terminal resize is now not propagated to the caller of key_get()/key_poll().

in addition: do not treat terminal resize as a key press
@dl1jbe
Copy link
Member

dl1jbe commented Feb 17, 2025

Makes sense.
But it seems to someway conflict with the packet screen, especially with the login procedure.
To reproduce unset CLUSTERLOGIN in logcfg.dat an start with packet support. Before entering your password resize the window. Login fails and cluster interface gets deactivated.

@zcsahok
Copy link
Member Author

zcsahok commented Feb 17, 2025

I got no issue with resize at the cluster login prompt. All worked as without resize.

@zcsahok
Copy link
Member Author

zcsahok commented Feb 17, 2025

Even the original code can cope with resize at cluster login. Interesting.

@dl1jbe
Copy link
Member

dl1jbe commented Feb 17, 2025

I got no issue with resize at the cluster login prompt. All worked as without resize.

Ok, I will dig in what happens here. I would say feel free to merge your PR in in meantime. If its reproducible here I will add another PR later.

Even the original code can cope with resize at cluster login. Interesting.

Yes that worked all the time.

@zcsahok zcsahok merged commit 1f422f2 into Tlf:master Feb 18, 2025
2 checks passed
@zcsahok zcsahok deleted the fix_resize_crash branch February 18, 2025 06:19
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

Successfully merging this pull request may close these issues.

2 participants