| Summary: | Warn about missed override of helper functions for QException descendants | ||
|---|---|---|---|
| Product: | [Developer tools] clazy | Reporter: | Roman <dismine> |
| Component: | general | Assignee: | Sergio Martins <smartins> |
| Status: | REPORTED --- | ||
| Severity: | wishlist | CC: | smartins |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Should they be pure virtual to begin with ? (In reply to Sergio Martins from comment #1) > Should they be pure virtual to begin with ? If you mean in QException class, i believe no, because QConcurrent need to throw something, but your code can just not expect QException, but something more specific. ok, makes sense |
According to documentation for the QException class, Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions. class MyException : public QException { public: void raise() const override { throw *this; } MyException *clone() const override { return new MyException(*this); } }; If such functions are not overridden in descendants, we can get unexpected behavior for exception thrown from a thread.