Destroy Wayland integration before Wayland disconnection
This commit is contained in:
parent
e9787170d5
commit
fc66a0eea8
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include <qpa/qplatformwindow_p.h>
|
#include <qpa/qplatformwindow_p.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
|
@ -157,22 +158,6 @@ WaylandIntegration::WaylandIntegration()
|
||||||
&Private::RegistryListener,
|
&Private::RegistryListener,
|
||||||
_private.get());
|
_private.get());
|
||||||
|
|
||||||
base::qt_signal_producer(
|
|
||||||
qApp,
|
|
||||||
&QObject::destroyed
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
// too late for standard destructors, just free
|
|
||||||
for (auto it = _private->plasmaSurfaces.begin()
|
|
||||||
; it != _private->plasmaSurfaces.cend()
|
|
||||||
; ++it) {
|
|
||||||
free(it->second.release());
|
|
||||||
_private->plasmaSurfaces.erase(it);
|
|
||||||
}
|
|
||||||
free(_private->plasmaShell.object());
|
|
||||||
_private->plasmaShell.init(nullptr);
|
|
||||||
free(_private->registry.release());
|
|
||||||
}, _private->lifetime);
|
|
||||||
|
|
||||||
wl_display_roundtrip(display);
|
wl_display_roundtrip(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,8 +165,15 @@ WaylandIntegration::~WaylandIntegration() = default;
|
||||||
|
|
||||||
WaylandIntegration *WaylandIntegration::Instance() {
|
WaylandIntegration *WaylandIntegration::Instance() {
|
||||||
if (!IsWayland()) return nullptr;
|
if (!IsWayland()) return nullptr;
|
||||||
static WaylandIntegration instance;
|
static std::optional<WaylandIntegration> instance(std::in_place);
|
||||||
return &instance;
|
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::skipTaskbarSupported() {
|
bool WaylandIntegration::skipTaskbarSupported() {
|
||||||
|
|
|
@ -12,15 +12,15 @@ namespace internal {
|
||||||
|
|
||||||
class WaylandIntegration {
|
class WaylandIntegration {
|
||||||
public:
|
public:
|
||||||
|
WaylandIntegration();
|
||||||
|
~WaylandIntegration();
|
||||||
|
|
||||||
[[nodiscard]] static WaylandIntegration *Instance();
|
[[nodiscard]] static WaylandIntegration *Instance();
|
||||||
|
|
||||||
[[nodiscard]] bool skipTaskbarSupported();
|
[[nodiscard]] bool skipTaskbarSupported();
|
||||||
void skipTaskbar(QWindow *window, bool skip);
|
void skipTaskbar(QWindow *window, bool skip);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WaylandIntegration();
|
|
||||||
~WaylandIntegration();
|
|
||||||
|
|
||||||
struct Private;
|
struct Private;
|
||||||
const std::unique_ptr<Private> _private;
|
const std::unique_ptr<Private> _private;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user