mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Ensure Wayland integration instance accessor doesn't leak
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Submodule Telegram/lib_base updated: e0763c0c7a...249814b334
Submodule Telegram/lib_ui updated: 1e89c19a03...8a56048801
Reference in New Issue
Block a user