-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve use of parented_ptr #13411
Improve use of parented_ptr #13411
Conversation
…er has always a parent.
Wdyt about adding some compile time checks to template<typename... Args>
concept AnyQObject = (... || std::is_base_of_v<QObject, Args>);
template<typename T, typename... Args>
parented_ptr<T> make_parented(Args...) requires (AnyQObject<Args...>) |
whoops. sorry its template<typename... Args>
constexpr bool AnyQObject = (... || std::is_base_of_v<QObject, std::remove_pointer_t<Args>>); |
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.
if you prefer I can also fix it locally and issue a PR to your branch once I got it working.
2131409
to
5bb0daf
Compare
ah nice, the static check actually caught something |
… allow the weak situation where an object is not memory managed. This reverts df77064 partially.
2a5eb7f
to
11d2f59
Compare
11d2f59
to
30e9db2
Compare
All green finally. Thank you for your perfect idea with the compile time check. |
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.
LGTM. thank you.
This PR fixed some cases where a patented_ptr is constructed without a parent. This creates a pointer that is temporary without any owner.
I have moved the assertion to the constructor to avoid this situation in future.
The risk is that we with debug assertion enabled, Mixxx will crash in case I have missed a case. So a double check during review is required.
This is part of the pending discussion about the future of parented_ptr in: #13395