From: David Maciejak <[email protected]>
The function 'RDestroyContext' have been defined in the API for a long time
but did not have an implementation, this patch fixes it.
---
wrlib/context.c | 15 +++++++++++++++
wrlib/libwraster.map | 1 +
2 files changed, 16 insertions(+)
diff --git a/wrlib/context.c b/wrlib/context.c
index b6794d0..7479009 100644
--- a/wrlib/context.c
+++ b/wrlib/context.c
@@ -688,6 +688,21 @@ RContext *RCreateContext(Display * dpy, int screen_number,
const RContextAttribu
return context;
}
+void RDestroyContext(RContext *context)
+{
+ if (context) {
+ if (context->copy_gc)
+ XFreeGC(context->dpy, context->copy_gc);
+ if (context->attribs) {
+ if ((context->attribs->flags & RC_VisualID) &&
+ !(context->attribs->flags & RC_DefaultVisual))
+ XDestroyWindow(context->dpy, context->drawable);
+ free(context->attribs);
+ }
+ free(context);
+ }
+}
+
static Bool bestContext(Display * dpy, int screen_number, RContext * context)
{
XVisualInfo *vinfo = NULL, rvinfo;
diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
index 6e165ef..422af75 100644
--- a/wrlib/libwraster.map
+++ b/wrlib/libwraster.map
@@ -33,6 +33,7 @@ LIBWRASTER3
RConvertImageMask;
RCopyArea;
RCreateContext;
+ RDestroyContext;
RCreateImage;
RCreateImageFromDrawable;
RCreateImageFromXImage;
--
1.9.2
--
To unsubscribe, send mail to [email protected].