Destroy Wayland integration before Wayland disconnection
This commit is contained in:
parent
a7d5031889
commit
1893967b4a
2 changed files with 13 additions and 13 deletions
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <qpa/qplatformwindow_p.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
|
|
@ -81,14 +82,6 @@ WaylandIntegration::WaylandIntegration()
|
|||
&Private::RegistryListener,
|
||||
_private.get());
|
||||
|
||||
base::qt_signal_producer(
|
||||
qApp,
|
||||
&QObject::destroyed
|
||||
) | rpl::start_with_next([=] {
|
||||
// too late for standard destructors, just free
|
||||
free(_private->registry.release());
|
||||
}, _private->lifetime);
|
||||
|
||||
wl_display_roundtrip(display);
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +89,15 @@ WaylandIntegration::~WaylandIntegration() = default;
|
|||
|
||||
WaylandIntegration *WaylandIntegration::Instance() {
|
||||
if (!::Platform::IsWayland()) return nullptr;
|
||||
static WaylandIntegration instance;
|
||||
return &instance;
|
||||
static std::optional<WaylandIntegration> instance(std::in_place);
|
||||
base::qt_signal_producer(
|
||||
QGuiApplication::platformNativeInterface(),
|
||||
&QObject::destroyed
|
||||
) | rpl::start_with_next([&] {
|
||||
instance = std::nullopt;
|
||||
}, instance->_private->lifetime);
|
||||
if (!instance) return nullptr;
|
||||
return &*instance;
|
||||
}
|
||||
|
||||
bool WaylandIntegration::xdgDecorationSupported() {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ namespace Platform {
|
|||
|
||||
class WaylandIntegration {
|
||||
public:
|
||||
WaylandIntegration();
|
||||
~WaylandIntegration();
|
||||
|
||||
[[nodiscard]] static WaylandIntegration *Instance();
|
||||
|
||||
[[nodiscard]] bool xdgDecorationSupported();
|
||||
|
|
@ -23,9 +26,6 @@ public:
|
|||
void showWindowMenu(not_null<QWidget*> widget, const QPoint &point);
|
||||
|
||||
private:
|
||||
WaylandIntegration();
|
||||
~WaylandIntegration();
|
||||
|
||||
struct Private;
|
||||
const std::unique_ptr<Private> _private;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue