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

show_blocking_widget debug option makes the application hang #2752

Closed
YgorSouza opened this issue Feb 18, 2023 · 1 comment · Fixed by #2753
Closed

show_blocking_widget debug option makes the application hang #2752

YgorSouza opened this issue Feb 18, 2023 · 1 comment · Fixed by #2753
Labels
bug Something is broken

Comments

@YgorSouza
Copy link
Contributor

Describe the bug

Enabling the show_blocking_widget option causes the application to hang. Observed both locally and on https://www.egui.rs/

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://www.egui.rs/
  2. Open Settings windows and expand the Debug collapsing header
  3. Check the last option "Show what widget blocks the interaction of another widget"
  4. The UI stops responding, without using any CPU

Expected behavior

The debug option draws the overlapping rectangles and doesn't freeze the UI.

Screenshots

Desktop (please complete the following information):

  • OS: Fedora 37
  • Browser Firefox
  • Version 110.0

Additional context

This is the code that runs when this option is enabled:

if ctx.memory.options.style.debug.show_blocking_widget {
Self::layer_painter(self, LayerId::debug()).debug_rect(
interact_rect,
Color32::GREEN,
"Covered",
);
Self::layer_painter(self, LayerId::debug()).debug_rect(
prev_rect,
Color32::LIGHT_BLUE,
"On top",
);
}

The problem seems to be that this code being called inside a Context::write() call, whereas both acquiring and using the layer painter requires some Context::read() and Context::write() calls, so it causes a deadlock.

@YgorSouza YgorSouza added the bug Something is broken label Feb 18, 2023
@crumblingstatue
Copy link
Contributor

I can reproduce it in the web version on chromium 110, Linux

YgorSouza added a commit to YgorSouza/egui that referenced this issue Feb 18, 2023
Calling the layer painter from inside a write() call causes a deadlock
on the Context. This change stores the necessary data (the two
overlapping Rects) in the write() call but uses them outside.

Closes emilk#2752
emilk pushed a commit that referenced this issue Feb 28, 2023
Calling the layer painter from inside a write() call causes a deadlock
on the Context. This change stores the necessary data (the two
overlapping Rects) in the write() call but uses them outside.

Closes #2752
mikedilger pushed a commit to mikedilger/egui that referenced this issue Mar 7, 2023
Calling the layer painter from inside a write() call causes a deadlock
on the Context. This change stores the necessary data (the two
overlapping Rects) in the write() call but uses them outside.

Closes emilk#2752
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants