miroil/display_listener_wrapper: Do not store a reference to shared_ptr#4953
miroil/display_listener_wrapper: Do not store a reference to shared_ptr#4953muhammad23012009 wants to merge 1 commit into
Conversation
Fixes the reference getting corrupted in QtMir.
There was a problem hiding this comment.
Pull request overview
This PR fixes a lifetime/ownership bug in the miroil QtMir integration by ensuring DisplayListenerWrapper owns its std::shared_ptr<mir::compositor::DisplayListener> instead of storing a reference to a shared_ptr that can dangle and become corrupted.
Changes:
- Replace the
std::shared_ptr<...> const&member with a by-valuestd::shared_ptr<...>member inDisplayListenerWrapperto make ownership/lifetime safe.
|
|
||
| private: | ||
| std::shared_ptr<mir::compositor::DisplayListener> const& display_listener; | ||
| std::shared_ptr<mir::compositor::DisplayListener> display_listener; |
|
I'm curious: how is this class useful? (I agree the |
DisplayListener is implemented by mir::server::shell, which is returned to QtMir as a result of miroil::SetCompositor. As DisplayListener itself is part of the internal API, miroil is used to alleviate that |
Fixes the reference getting corrupted in QtMir.
Checklist