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

possible regression in 0.28 vs 0.27 in dnd_drag_source #4883

Closed
3gx opened this issue Jul 27, 2024 · 4 comments
Closed

possible regression in 0.28 vs 0.27 in dnd_drag_source #4883

3gx opened this issue Jul 27, 2024 · 4 comments
Labels
bug Something is broken crash crash, panic, segfault, freeze, … drag-and-drop

Comments

@3gx
Copy link

3gx commented Jul 27, 2024

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. In tutorial https://github.com/emilk/egui/blob/master/crates/egui_demo_lib/src/demo/drag_and_drop.rs#L72C1-L75C1,
    replace
                        let response = ui
                            .dnd_drag_source(item_id, item_location, |ui| {
                                ui.label(item);
                            })
                            .response;

with

                        let response = ui
                            .dnd_drag_source(item_id, item_location, |ui| {
                                ui.vertical(|ui| {
                                  ui.label("--");
                                  ui.label(item);
                                 });
                            })
                            .response;
  1. Click on it

  2. Error

thread 'main' panicked at /Users/egx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-0.28.1/src/widget_rect.rs:142:17:
Widget changed layer_id during the frame
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at /Users/egx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/macos/app_state.rs:387:33:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Expected behavior
Can be dragged with 0.27

Screenshots

Desktop (please complete the following information):

  • OS: MacOS 14.5
@3gx 3gx added the bug Something is broken label Jul 27, 2024
@HactarCE
Copy link
Contributor

I'm experiencing this in my app, but I'm able to use ui.push_id() as a workaround. I can elaborate if anyone would like more details.

@3gx
Copy link
Author

3gx commented Sep 1, 2024

I'm experiencing this in my app, but I'm able to use ui.push_id() as a workaround. I can elaborate if anyone would like more details.

Yes, I would appreciate if you can share your workaround. Than you.

@emilk emilk added this to the Next Major Release milestone Sep 2, 2024
@emilk emilk added the crash crash, panic, segfault, freeze, … label Sep 2, 2024
@HactarCE
Copy link
Contributor

HactarCE commented Sep 3, 2024

@3gx I'm using my own version of egui's drag-and-drop API but the solution can probably be adapted to work. Try ui.dnd_drag_source(item_id, item_location, |ui| ui.push_id(id, |ui| ...)) (with some unique id).

@emilk
Copy link
Owner

emilk commented Sep 30, 2024

@emilk emilk closed this as completed Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken crash crash, panic, segfault, freeze, … drag-and-drop
Projects
None yet
Development

No branches or pull requests

3 participants