Re-use the Wayland AutoDestroyer's lifetime in WaylandIntegration::Private

This commit is contained in:
Ilya Fedin 2023-09-16 04:23:53 +04:00 committed by John Preston
parent 8d005bc820
commit 94f9bbefd7

View file

@ -27,7 +27,6 @@ namespace Platform {
struct WaylandIntegration::Private : public AutoDestroyer<QtWayland::wl_registry> { struct WaylandIntegration::Private : public AutoDestroyer<QtWayland::wl_registry> {
std::optional<uint32_t> xdgDecoration; std::optional<uint32_t> xdgDecoration;
rpl::lifetime lifetime;
protected: protected:
void registry_global( void registry_global(
@ -73,7 +72,7 @@ WaylandIntegration *WaylandIntegration::Instance() {
&QObject::destroyed &QObject::destroyed
) | rpl::start_with_next([] { ) | rpl::start_with_next([] {
instance = std::nullopt; instance = std::nullopt;
}, instance->_private->lifetime); }, instance->_private->lifetime());
return true; return true;
}(); }();
if (!instance) return nullptr; if (!instance) return nullptr;