forked from old/legacy-imlib2
Introduce imlib_context_disconnect_display().
imlib_context_disconnect_display() should be called when a display connection is closed but the application continues using imlib2 with a different display connection. This is required to avoid to attempt to free cached GCs (in __imlib_RenderImage) after the associated display connection has been closed. It is not unlikely that similar cleanups should be performed elsewhere in this situation, but the __imlib_RenderImage GCs is the only case I have found to cause trouble so far. SVN revision: 35463
This commit is contained in:
parent
18a8e18546
commit
cd929604a1
|
@ -131,6 +131,7 @@ extern "C"
|
|||
/* context setting */
|
||||
# ifndef X_DISPLAY_MISSING
|
||||
EAPI void imlib_context_set_display(Display * display);
|
||||
EAPI void imlib_context_disconnect_display(void);
|
||||
EAPI void imlib_context_set_visual(Visual * visual);
|
||||
EAPI void imlib_context_set_colormap(Colormap colormap);
|
||||
EAPI void imlib_context_set_drawable(Drawable drawable);
|
||||
|
|
|
@ -314,8 +314,8 @@ imlib_context_get_cliprect(int *x, int *y, int *w, int *h)
|
|||
}
|
||||
|
||||
#ifdef BUILD_X11
|
||||
/**
|
||||
* @param display Current display to bu used.
|
||||
/**
|
||||
* @param display Current display to be used.
|
||||
*
|
||||
* Sets the current X display to be used for rendering of images to
|
||||
* drawables. You do not need to set this if you do not intend to
|
||||
|
@ -345,6 +345,22 @@ imlib_context_get_display(void)
|
|||
return ctx->display;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell Imlib2 that the current display connection has been closed.
|
||||
*
|
||||
* Call when (and only when) you close a display connection but continue
|
||||
* using Imlib2 on a different connection.
|
||||
*/
|
||||
EAPI void
|
||||
imlib_context_disconnect_display(void)
|
||||
{
|
||||
CHECK_CONTEXT(ctx);
|
||||
if (!ctx->display)
|
||||
return;
|
||||
__imlib_RenderDisconnect(ctx->display);
|
||||
ctx->display = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param visual Current visual to use.
|
||||
*
|
||||
|
|
|
@ -235,6 +235,21 @@ __imlib_generic_render(DATA32 * src, int jump, int w, int h, int dx, int dy,
|
|||
}
|
||||
}
|
||||
|
||||
static Display *disp = NULL;
|
||||
static GC gc = NULL;
|
||||
static GC gcm = NULL;
|
||||
static int last_depth = 0;
|
||||
|
||||
void
|
||||
__imlib_RenderDisconnect(Display * d)
|
||||
{
|
||||
if (d != disp)
|
||||
return;
|
||||
disp = NULL;
|
||||
gc = gcm = NULL;
|
||||
last_depth = 0;
|
||||
}
|
||||
|
||||
void
|
||||
__imlib_RenderImage(Display * d, ImlibImage * im,
|
||||
Drawable w, Drawable m,
|
||||
|
@ -248,10 +263,6 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
|
|||
Context *ct;
|
||||
DATA32 *buf = NULL, *pointer = NULL, *back = NULL;
|
||||
int y, h, hh, jump;
|
||||
static Display *disp = NULL;
|
||||
static int last_depth = 0;
|
||||
static GC gc = 0;
|
||||
static GC gcm = 0;
|
||||
XGCValues gcv;
|
||||
ImlibScaleInfo *scaleinfo = NULL;
|
||||
int psx, psy, psw, psh;
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
__hidden DATA32
|
||||
__imlib_RenderGetPixel(Display *d, Drawable w, Visual *v, Colormap cm, int depth, DATA8 r, DATA8 g, DATA8 b);
|
||||
|
||||
__hidden void
|
||||
__imlib_RenderDisconnect(Display *d);
|
||||
|
||||
__hidden void
|
||||
__imlib_RenderImage(Display *d, ImlibImage *im,
|
||||
Drawable w, Drawable m,
|
||||
|
|
Loading…
Reference in New Issue