mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
LibGUI: Revert GWindowServerConnection to being a singleton
This was a mistake, of course. Nested event loops don't need (or want) independent server connections. We initialize the connection early in GEventLoop for e.g. users that want to get the size of a GDesktop before the connection has been established. Bug noticed by Andreas, introduced by me ;-)
This commit is contained in:
parent
4adbddeb36
commit
7a53096e8d
10 changed files with 50 additions and 40 deletions
|
@ -23,6 +23,16 @@
|
|||
//#define GEVENTLOOP_DEBUG
|
||||
//#define COALESCING_DEBUG
|
||||
|
||||
GWindowServerConnection& GWindowServerConnection::the()
|
||||
{
|
||||
static GWindowServerConnection* s_connection = nullptr;
|
||||
if (!s_connection) {
|
||||
s_connection = new GWindowServerConnection();
|
||||
s_connection->handshake();
|
||||
}
|
||||
return *s_connection;
|
||||
}
|
||||
|
||||
void GWindowServerConnection::handshake()
|
||||
{
|
||||
WSAPI_ClientMessage request;
|
||||
|
@ -34,7 +44,9 @@ void GWindowServerConnection::handshake()
|
|||
|
||||
GEventLoop::GEventLoop()
|
||||
{
|
||||
m_connection.handshake();
|
||||
// ensure the WS connection is up, as our users might be expecting it to be
|
||||
// valid very early (via e.g. GDesktop) :)
|
||||
GWindowServerConnection::the();
|
||||
}
|
||||
|
||||
GEventLoop::~GEventLoop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue