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

Fix crash in printer config when switching tabs #6537

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

Noisyfox
Copy link
Collaborator

This fixes #6486

@Noisyfox
Copy link
Collaborator Author

Noisyfox commented Aug 23, 2024

Some explainations:
e139fd18f297062e1ff94cf4e2cb545c
See the upper call stack. When switching tabs after updating any values, the tab's button's event handler will trigger a refreshing of the printer config screen, which will call DeleteAllItems, which will delete the tab button that's currently running the eventhandler, that causes this use-after-free crash.

This PR updates the tab buttons in place and avoid destroying buttons when unnecessary.

@@ -470,7 +470,7 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
int count = 0;
int step = 10;
// Orca: use 500 x 500 bed size as baseline.
auto grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
const Point grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
Copy link
Collaborator Author

@Noisyfox Noisyfox Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line caused false address sanitizer exceptions that prevented me from debugging the real poblem so I fixed this. Isn't really related to the crash though.

Copy link
Owner

@SoftFever SoftFever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, no more crashes and switching from single tool to multi tool machine works fine as well.
Thank you!

@SoftFever SoftFever merged commit a68fc86 into SoftFever:main Aug 23, 2024
15 checks passed
@Noisyfox Noisyfox deleted the bugfox/device-crash branch August 23, 2024 15:19
@Noisyfox Noisyfox mentioned this pull request Aug 24, 2024
henrivdr pushed a commit to henrivdr/OrcaSlicer that referenced this pull request Aug 27, 2024
* Fix ASAN with MSVC

* Make ASAN happy

* Avoid deleting activated tab button by not calling `DeleteAllItems` (#SoftFever#6486)
henrivdr pushed a commit to henrivdr/OrcaSlicer that referenced this pull request Sep 2, 2024
* Fix ASAN with MSVC

* Make ASAN happy

* Avoid deleting activated tab button by not calling `DeleteAllItems` (#SoftFever#6486)
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.

v2.2 Nightly Dev's crashing when editing (custom) Printer Settings
2 participants