Cache the xcb_connection_t* in connection()
This is for two reasons: 1. Fixes crash on tear-down when XGetXCBConnection returns junk 2. In Qt5 getting the connection is not cheap enough for our uses REVIEW: 108826
This commit is contained in:
parent
f45ade7785
commit
e72fec3110
1 changed files with 5 additions and 1 deletions
|
@ -138,7 +138,11 @@ KWIN_EXPORT Display* display()
|
|||
inline
|
||||
KWIN_EXPORT xcb_connection_t *connection()
|
||||
{
|
||||
return XGetXCBConnection(display());
|
||||
static xcb_connection_t *s_con = NULL;
|
||||
if (!s_con) {
|
||||
s_con = XGetXCBConnection(display());
|
||||
}
|
||||
return s_con;
|
||||
}
|
||||
|
||||
inline
|
||||
|
|
Loading…
Reference in a new issue