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
remotes/origin/Plasma/5.0
Martin Gräßlin 13 years ago
parent f45ade7785
commit e72fec3110
  1. 6
      libkwineffects/kwinglobals.h

@ -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…
Cancel
Save