-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Measurement: Fix macos crashes caused by unhandled exceptions reaching qt #16906
Measurement: Fix macos crashes caused by unhandled exceptions reaching qt #16906
Conversation
So I was looking into this before seeing this PR. |
@PaddleStroke More information an links to a Qt bug on the topic can be found here What this means for us is that all places where a linux user might get a error message For this bug, the callstack looked follows (click to expand)
At the top of the stack is where the thread was killed due to unhandled exception (it never goes through qt on macos:arm64, on linux it does and is handled)
The exception was thrown here:
MeasureGui was invoked using the slot here:
The slot was called by a timedout QTimer:
The event was sent by QApplication's notify:
Here is Gui::GuiApplication::notify where we are trying to catch the event, but it doesn't work as explained in the Qt ticket
The tail here isn't really that interesting, but I'll keep it for the record:
As can be seen in the call stack, the point of entry was processSelection and since there already was a try-catch-structure there, I simply added:
In other words, I moved up the error handling from GuiApplication::notify to the last point before the exception would reach Qt which would cause a crash. I haven't checked if there are more slots which could be called. If so those needs to be handled as well. To answer your question, I looked at the two try-catch structures in measurement and it seems like they are utility functions, not slots, so it might not be needed. |
Backported to 1.0 |
As described in #16905, macos crashes when exceptions are reaching qt.
The crash this PR fixes is described this comment: #16888 (comment)
The reason why FreeCAD crashes is:
QuickMeasure::processSelection()
This PR adds a catch for OCCT exceptions as well as a generic for unknown exceptions.
Note, this doesn't fix the bug, but it fixes the crash.