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

Crash: tooltips cause an infinite loop #660

Open
Adamskye opened this issue Jul 10, 2024 · 2 comments
Open

Crash: tooltips cause an infinite loop #660

Adamskye opened this issue Jul 10, 2024 · 2 comments

Comments

@Adamskye
Copy link

I have attached a copy of a program I am working on in its very early stages which suffers from this issue.

In the experimentation I've done with the program I've attached, the requirements for this crash to occur are as follows:

  • Have some widgets that show tooltips when hovered over.
  • Don't call nk_convert every single frame (as per the documentation's recommendation, I am only drawing frames where something changes, so I'm not calling nk_convert every frame).
  • Move your mouse between two widgets that show a tooltip on hover. In my program, the easiest way to trigger the crash is to switch between the Project and Chain pages in the bottom left.

The crash occurs in nk_convert and seems to be because nk_foreach enters an infinite loop. This causes the program to freeze, CPU usage to spike to 100% and memory usage to slowly climb.

In my program, I have patched nk_convert so that it detects when an infinite loop is starting, prints a message, then breaks from nk_foreach. While this ideally shouldn't be needed, it is better than redrawing every frame or abandoning the use of tooltips entirely.

I've noticed that somebody else has had this issue several years ago (#168) although my problem is due to tooltips and the cause of the infinite loop seems different to how he described ('next' is not set to 0). I also can provide a program that has the issue so it should hopefully be easier to diagnose.

MinDAWBroken.zip

@Adamskye
Copy link
Author

There's another thing I forgot to add. I don't know if this is relevant or not, but whenever I am moving my mouse between widgets that open tooltips, the command buffer is resizing itself a lot. Perhaps it's being corrupted in the process of being resized? I'll test with nk_init_fixed and see what happens.

@RobLoach
Copy link
Contributor

I believe there can only be one tooltip shown at a time, since they use the same popup identifier. Is there a way you could put some guardrails in place?

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

2 participants