From: Kenichi Handa Date: Thu, 31 Jul 2003 00:52:19 +0000 (+0000) Subject: (x_create_bitmap_from_data): Initialize have_mask member to 0. X-Git-Tag: ttn-vms-21-2-B4~9198 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=97e7188e573bc75cd99cd5ab14b7291d2451364f;p=emacs.git (x_create_bitmap_from_data): Initialize have_mask member to 0. (x_create_bitmap_from_file): Likewise. (x_destroy_bitmap): Check have_mask member before freeing a mask. (x_destroy_all_bitmaps): Likewise. (x_create_bitmap_mask): Set have_mask member to 1. --- diff --git a/src/ChangeLog b/src/ChangeLog index f076c78de4b..420c9f6c0f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2003-07-31 Kenichi Handa + + * xterm.h (struct x_bitmap_record): New member have_mask. + + * xfns.c (x_create_bitmap_from_data): Initialize have_mask member + to 0. + (x_create_bitmap_from_file): Likewise. + (x_destroy_bitmap): Check have_mask member before freeing a mask. + (x_destroy_all_bitmaps): Likewise. + (x_create_bitmap_mask): Set have_mask member to 1. + 2003-07-30 Richard M. Stallman * Makefile.in (CFLAGS) [!OPTIMIZE]: Undo previous change. diff --git a/src/xfns.c b/src/xfns.c index 4ce7dec41d7..b567b11d283 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -623,6 +623,7 @@ x_create_bitmap_from_data (f, bits, width, height) id = x_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; + dpyinfo->bitmaps[id - 1].have_mask = 0; dpyinfo->bitmaps[id - 1].file = NULL; dpyinfo->bitmaps[id - 1].refcount = 1; dpyinfo->bitmaps[id - 1].depth = 1; @@ -674,6 +675,7 @@ x_create_bitmap_from_file (f, file) id = x_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; + dpyinfo->bitmaps[id - 1].have_mask = 0; dpyinfo->bitmaps[id - 1].refcount = 1; dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1); @@ -701,7 +703,8 @@ x_destroy_bitmap (f, id) { BLOCK_INPUT; XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].pixmap); - XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].mask); + if (dpyinfo->bitmaps[id - 1].have_mask) + XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].mask); if (dpyinfo->bitmaps[id - 1].file) { xfree (dpyinfo->bitmaps[id - 1].file); @@ -723,7 +726,8 @@ x_destroy_all_bitmaps (dpyinfo) if (dpyinfo->bitmaps[i].refcount > 0) { XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].pixmap); - XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].mask); + if (dpyinfo->bitmaps[i].have_mask) + XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].mask); if (dpyinfo->bitmaps[i].file) xfree (dpyinfo->bitmaps[i].file); } @@ -822,6 +826,7 @@ x_create_bitmap_mask(f, id) width, height); XFreeGC (FRAME_X_DISPLAY (f), gc); + dpyinfo->bitmaps[id - 1].have_mask = 1; dpyinfo->bitmaps[id - 1].mask = mask; XDestroyImage (ximg);