comparison mac/dw.m @ 917:8567c9ac089d

Switched back to using the dealloc() method in dw_pixmap_destroy() to stop a memory leak on the Mac. We are not really supposed to call dealloc directly usually but, not sure why release is not freeing the memory.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 22 Apr 2011 04:23:00 +0000
parents 44a0f9a2e8f9
children 6b400a0f5f70
comparison
equal deleted inserted replaced
916:44a0f9a2e8f9 917:8567c9ac089d
428 } 428 }
429 else 429 else
430 { 430 {
431 if([bltdest lockFocusIfCanDraw] == NO) 431 if([bltdest lockFocusIfCanDraw] == NO)
432 { 432 {
433 free(bltinfo);
433 return; 434 return;
434 } 435 }
435 _DWLastDrawable = bltinfo->dest; 436 _DWLastDrawable = bltinfo->dest;
436 } 437 }
437 if([bltsrc isMemberOfClass:[NSBitmapImageRep class]]) 438 if([bltsrc isMemberOfClass:[NSBitmapImageRep class]])
5910 NSSize size = [image size]; 5911 NSSize size = [image size];
5911 pixmap->width = size.width; 5912 pixmap->width = size.width;
5912 pixmap->height = size.height; 5913 pixmap->height = size.height;
5913 pixmap->image = image; 5914 pixmap->image = image;
5914 pixmap->handle = handle; 5915 pixmap->handle = handle;
5916 [image retain];
5915 return pixmap; 5917 return pixmap;
5916 } 5918 }
5917 5919
5918 /* 5920 /*
5919 * Creates a pixmap from memory. 5921 * Creates a pixmap from memory.
5936 NSSize size = [image size]; 5938 NSSize size = [image size];
5937 pixmap->width = size.width; 5939 pixmap->width = size.width;
5938 pixmap->height = size.height; 5940 pixmap->height = size.height;
5939 pixmap->image = image; 5941 pixmap->image = image;
5940 pixmap->handle = handle; 5942 pixmap->handle = handle;
5943 [image retain];
5941 return pixmap; 5944 return pixmap;
5942 } 5945 }
5943 5946
5944 /* 5947 /*
5945 * Sets the transparent color for a pixmap 5948 * Sets the transparent color for a pixmap
5977 NSSize size = [image size]; 5980 NSSize size = [image size];
5978 pixmap->width = size.width; 5981 pixmap->width = size.width;
5979 pixmap->height = size.height; 5982 pixmap->height = size.height;
5980 pixmap->image = image; 5983 pixmap->image = image;
5981 pixmap->handle = handle; 5984 pixmap->handle = handle;
5985 [image retain];
5982 return pixmap; 5986 return pixmap;
5983 } 5987 }
5984 5988
5985 /* 5989 /*
5986 * Destroys an allocated pixmap. 5990 * Destroys an allocated pixmap.
5989 * dw_pixmap_new.. 5993 * dw_pixmap_new..
5990 */ 5994 */
5991 void API dw_pixmap_destroy(HPIXMAP pixmap) 5995 void API dw_pixmap_destroy(HPIXMAP pixmap)
5992 { 5996 {
5993 NSBitmapImageRep *image = (NSBitmapImageRep *)pixmap->image; 5997 NSBitmapImageRep *image = (NSBitmapImageRep *)pixmap->image;
5994 [image release]; 5998 [image dealloc];
5995 free(pixmap); 5999 free(pixmap);
5996 } 6000 }
5997 6001
5998 /* 6002 /*
5999 * Copies from one item to another. 6003 * Copies from one item to another.