Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fix cleanup functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyps committed Jul 21, 2010
1 parent 847d910 commit cee756f
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/video/x11/SDL_x11render.c
Expand Up @@ -2040,6 +2040,13 @@ X11_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
shmdt(data->shminfo.shmaddr);
data->pixels = NULL;
}
#endif
#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
if (renderdata->use_xrender) {
if (data->picture) {
XRenderFreePicture(renderdata->display, data->picture);
}
}
#endif
if (data->scaling_image) {
SDL_free(data->scaling_image->data);
Expand All @@ -2065,7 +2072,7 @@ X11_DestroyRenderer(SDL_Renderer * renderer)
XFreePixmap(data->display, data->pixmaps[i]);
}
#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
if (data->pixmap_picts[i] != None) {
if (data->use_xrender && data->pixmap_picts[i]) {
XRenderFreePicture(data->display, data->pixmap_picts[i]);
}
#endif
Expand All @@ -2074,17 +2081,24 @@ X11_DestroyRenderer(SDL_Renderer * renderer)
XFreeGC(data->display, data->gc);
}
#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
if (data->stencil_gc) {
XFreeGC(data->display, data->stencil_gc);
}
if (data->stencil) {
XFreePixmap(data->display, data->stencil);
}
if (data->drawable_pict) {
XRenderFreePicture(data->display, data->drawable_pict);
}
if (data->xwindow_pict) {
XRenderFreePicture(data->display, data->xwindow_pict);
if (data->use_xrender) {
if (data->stencil_gc) {
XFreeGC(data->display, data->stencil_gc);
}
if (data->stencil) {
XFreePixmap(data->display, data->stencil);
}
if (data->stencil_pict) {
XRenderFreePicture(data->display, data->stencil_pict);
}
if (data->xwindow_pict) {
XRenderFreePicture(data->display, data->xwindow_pict);
}
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
if (data->use_xdamage && data->stencil_damage) {
XDamageDestroy(data->display, data->stencil_damage);
}
#endif
}
#endif
SDL_FreeDirtyRects(&data->dirty);
Expand Down

0 comments on commit cee756f

Please sign in to comment.