mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Ensure Wayland integration instance accessor doesn't leak
This commit is contained in:
parent
c9179b78b3
commit
a3cdf19c1f
3 changed files with 11 additions and 8 deletions
|
@ -123,12 +123,15 @@ WaylandIntegration::~WaylandIntegration() = default;
|
||||||
WaylandIntegration *WaylandIntegration::Instance() {
|
WaylandIntegration *WaylandIntegration::Instance() {
|
||||||
if (!IsWayland()) return nullptr;
|
if (!IsWayland()) return nullptr;
|
||||||
static std::optional<WaylandIntegration> instance(std::in_place);
|
static std::optional<WaylandIntegration> instance(std::in_place);
|
||||||
base::qt_signal_producer(
|
[[maybe_unused]] static const auto Inited = [] {
|
||||||
QGuiApplication::platformNativeInterface(),
|
base::qt_signal_producer(
|
||||||
&QObject::destroyed
|
QGuiApplication::platformNativeInterface(),
|
||||||
) | rpl::start_with_next([&] {
|
&QObject::destroyed
|
||||||
instance = std::nullopt;
|
) | rpl::start_with_next([] {
|
||||||
}, instance->_private->lifetime);
|
instance = std::nullopt;
|
||||||
|
}, instance->_private->lifetime);
|
||||||
|
return true;
|
||||||
|
}();
|
||||||
if (!instance) return nullptr;
|
if (!instance) return nullptr;
|
||||||
return &*instance;
|
return &*instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e0763c0c7ae38c89e09b0d41080293a0cb77ecde
|
Subproject commit 249814b3343c5ed06b56597ac870df81c77f8417
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1e89c19a03ddd654e063e26fbb5223247212822d
|
Subproject commit 8a560488011f833b7ba534999f878d20d5152e6c
|
Loading…
Add table
Reference in a new issue