diff options
-rw-r--r-- | include/X11/Xlibint.h | 1 | ||||
-rw-r--r-- | src/GetDflt.c | 5 | ||||
-rw-r--r-- | src/OpenDis.c | 3 | ||||
-rw-r--r-- | src/Xrm.c | 5 |
4 files changed, 11 insertions, 3 deletions
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h index eaa9738..c1966ad 100644 --- a/include/X11/Xlibint.h +++ b/include/X11/Xlibint.h @@ -386,6 +386,7 @@ extern LockInfoPtr _Xglobal_lock; #define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ #define XlibDisplayReply (1L << 5) /* in _XReply */ #define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ +#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ /* * X Protocol packetizing macros. diff --git a/src/GetDflt.c b/src/GetDflt.c index 6146ca4..3c7ba34 100644 --- a/src/GetDflt.c +++ b/src/GetDflt.c @@ -239,8 +239,9 @@ XGetDefault( */ LockDisplay(dpy); if (dpy->db == NULL) { - dpy->db = InitDefaults(dpy); - } + dpy->db = InitDefaults(dpy); + dpy->flags |= XlibDisplayDfltRMDB; + } UnlockDisplay(dpy); names[0] = XrmStringToName(progname); diff --git a/src/OpenDis.c b/src/OpenDis.c index b5e2b49..f9a148d 100644 --- a/src/OpenDis.c +++ b/src/OpenDis.c @@ -761,7 +761,8 @@ void _XFreeDisplayStructure(dpy) if (dpy->xkb_info) (*dpy->free_funcs->xkb)(dpy); - if (dpy->db) + /* if RM database was allocated by XGetDefault() free it */ + if (dpy->db && (dpy->flags & XlibDisplayDfltRMDB)) XrmDestroyDatabase(dpy->db); if (dpy->screens) { @@ -348,6 +348,11 @@ void XrmSetDatabase( XrmDatabase database) { LockDisplay(display); + /* destroy database if set up imlicitely by XGetDefault() */ + if (display->db && (display->flags & XlibDisplayDfltRMDB)) { + XrmDestroyDatabase(display->db); + display->flags &= ~XlibDisplayDfltRMDB; + } display->db = database; UnlockDisplay(display); } |