Free the drag-and-drop proxy after closing editors

Apparently X11 connections are a scarce resource, so it seems like a
good idea to not hang on to them for too long. Now this is sort of a
hybrid between COM-style memory management and a singleton.
This commit is contained in:
Robbert van der Helm
2021-07-10 00:07:21 +02:00
parent b1e3488a24
commit 2ba2cf1ab7
4 changed files with 78 additions and 9 deletions
+1 -2
View File
@@ -20,8 +20,6 @@
#include <boost/container/small_vector.hpp>
#include "xdnd-proxy.h"
using namespace std::literals::chrono_literals;
// A catchable alternative to `assert()`. Normally all of our `assert(!error)`
@@ -204,6 +202,7 @@ Editor::Editor(MainContext& main_context,
std::optional<fu2::unique_function<void()>> timer_proc)
: use_xembed(config.editor_xembed),
x11_connection(xcb_connect(nullptr, nullptr), xcb_disconnect),
dnd_proxy_handle(WineXdndProxy::init_proxy()),
client_area(get_maximum_screen_dimensions(*x11_connection)),
// Create a window without any decoratiosn for easy embedding. The
// combination of `WS_EX_TOOLWINDOW` and `WS_POPUP` causes the window to