-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Fix a crash when plugin tries to call make_mesh_previews
on enable
#81121
Fix a crash when plugin tries to call make_mesh_previews
on enable
#81121
Conversation
That doesn't look like a good fix. We just end up not updating the list when it is requested because a tree is propagating mouse events. It seems to me that such situation should never arise in the first place, otherwise every tree is potentially error-prone (you either crash or miss an update that you need). What the solution would look like I'm not sure. For this particular case, though, we should find a way to block |
I agree this is not the perfect solution for this, and such situation should never arise in the first place. But I find it hard to break the chain, It seems like delay any of this chain's function to next frame is dangerous and non trivial. And in this particular case I think my fix is fine because the |
That is a problem in and of itself. This method internally moves the main loop two frames ahead. This already can result in unexpected behavior. |
Or we can remove the
The code does look suspicious to me. |
We can remove Ideally, |
The easiest and least invasive fix is adding |
Apply @KoBeWi 's suggestion, godot will complain about “Do not use progress dialog (task) while flushing the message queue or using call_deferred()!”, it seems we still need to remove Also,
The code will make the mrp project with plugin enabled crash at start. Without them it's fine. Should I remove them too? |
c5719fa
to
eaa452a
Compare
It does not crash though, so the error is harmless. I'd say the original issue comes from the wrong usage of |
What do you think about making it asynchronous, like |
That could work, but it would require a signal for finishing and it's a compatibility breakage (on behavior level). |
Based on your discussion, I guess for this crash we can just add Should I remove |
Main::iteration is required to render the meshes. It forces the MainLoop to progress as if a frame has passed. |
The bug happens when plugin tree is propagating mouse events (so it is blocked), but EditorProgress's dtor will make main editor focused and call update_plugins immediately which will update the blocked tree.
eaa452a
to
7e3a762
Compare
For the record, the progress dialog makes itself responsive by also calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's basically a temporary fix, but it's harmless, so probably fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the crash, though I'm not sure make_mesh_previews
is working as expected in the MRP. On the first call it doesn't seem to return anything.
But that's a bigger problem, as discussed. This should be fine for now to prevent the most problematic part of it.
Thanks! |
Cherry-picked for 4.1.2. |
make_mesh_previews
make_mesh_previews
on enable
Fixes #80333
When we update the plugin list, we should check the tree is blocked or not, if blocked,
create_item
will return nullptr and thus cause crash.