comparison ios/dw.m @ 2819:a2fc275fa9bb

iOS: Fix major memory leaks when destroying widgets and windows. More surely needs to be done regardig this, iOS doesn't destroy subviews as expected when the parent is removed. I was expecting it to bring the reference counts to 0 and starts destroying subviews... so I had to do this manually. Boxes, ScrollBoxes, Spinbuttons and Comboboxes all now destroy their subviews. Probably will need to do the same for splitbar, notebooks and possibly others. However this stops the memory leak in Interface Builder when recreating the interface. Also need to figure out why the reference count is lower for DWButtons.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 02 Aug 2022 06:17:09 +0000
parents d5d09bdd61d6
children b6ae5b017b28
comparison
equal deleted inserted replaced
2818:d5d09bdd61d6 2819:a2fc275fa9bb
789 if(box->items) 789 if(box->items)
790 free(box->items); 790 free(box->items);
791 free(box); 791 free(box);
792 _dw_remove_userdata(&root, NULL, TRUE); 792 _dw_remove_userdata(&root, NULL, TRUE);
793 dw_signal_disconnect_by_window(self); 793 dw_signal_disconnect_by_window(self);
794 for(id object in [self subviews])
795 {
796 NSUInteger rc = [object retainCount];
797 [object removeFromSuperview];
798 /* TODO: Fix the cause of this...
799 * DWButtons have a lower retain count than the other widgets...
800 * so this release causes a crash. Figure out why it is lower...
801 * and make the others that way too.
802 */
803 if(rc > 2)
804 [object release];
805 }
794 [super dealloc]; 806 [super dealloc];
795 } 807 }
796 -(Box *)box { return box; } 808 -(Box *)box { return box; }
797 -(void *)userdata { return userdata; } 809 -(void *)userdata { return userdata; }
798 -(void)setUserdata:(void *)input { userdata = input; } 810 -(void)setUserdata:(void *)input { userdata = input; }
2003 @implementation DWScrollBox 2015 @implementation DWScrollBox
2004 -(void *)userdata { return userdata; } 2016 -(void *)userdata { return userdata; }
2005 -(void)setUserdata:(void *)input { userdata = input; } 2017 -(void)setUserdata:(void *)input { userdata = input; }
2006 -(void)setBox:(void *)input { box = input; } 2018 -(void)setBox:(void *)input { box = input; }
2007 -(id)box { return box; } 2019 -(id)box { return box; }
2008 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } 2020 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [box removeFromSuperview]; [box release]; [super dealloc]; }
2009 @end 2021 @end
2010 2022
2011 /* Subclass for a entryfield type */ 2023 /* Subclass for a entryfield type */
2012 @interface DWEntryField : UITextField <UITextFieldDelegate> 2024 @interface DWEntryField : UITextField <UITextFieldDelegate>
2013 { 2025 {
2197 -(id)topLeft { return topleft; } 2209 -(id)topLeft { return topleft; }
2198 -(void)setTopLeft:(id)input 2210 -(void)setTopLeft:(id)input
2199 { 2211 {
2200 topleft = input; 2212 topleft = input;
2201 [self addSubview:topleft]; 2213 [self addSubview:topleft];
2202 [topleft autorelease]; 2214 [topleft release];
2203 } 2215 }
2204 -(id)bottomRight { return bottomright; } 2216 -(id)bottomRight { return bottomright; }
2205 -(void)setBottomRight:(id)input 2217 -(void)setBottomRight:(id)input
2206 { 2218 {
2207 bottomright = input; 2219 bottomright = input;
2208 [self addSubview:bottomright]; 2220 [self addSubview:bottomright];
2209 [bottomright autorelease]; 2221 [bottomright release];
2210
2211 } 2222 }
2212 -(int)type { return splittype; } 2223 -(int)type { return splittype; }
2213 -(void)setType:(int)input { splittype = input; } 2224 -(void)setType:(int)input { splittype = input; }
2214 -(void)resize 2225 -(void)resize
2215 { 2226 {
2300 /* TODO: UITableView does not support variable columns... 2311 /* TODO: UITableView does not support variable columns...
2301 * also OutlineView does not exist in iOS. 2312 * also OutlineView does not exist in iOS.
2302 */ 2313 */
2303 UITableViewCell *_dw_table_cell_view_new(UIImage *icon, NSString *text) 2314 UITableViewCell *_dw_table_cell_view_new(UIImage *icon, NSString *text)
2304 { 2315 {
2305 UITableViewCell *browsercell = [[[UITableViewCell alloc] init] autorelease]; 2316 UITableViewCell *browsercell = [[UITableViewCell alloc] init];
2306 [browsercell setAutoresizesSubviews:YES]; 2317 [browsercell setAutoresizesSubviews:YES];
2307 2318
2308 if(icon) 2319 if(icon)
2309 [[browsercell imageView] setImage:icon]; 2320 [[browsercell imageView] setImage:icon];
2310 if(text) 2321 if(text)
3296 { 3307 {
3297 self = [super init]; 3308 self = [super init];
3298 3309
3299 if(self) 3310 if(self)
3300 { 3311 {
3301 textfield = [[[UITextField alloc] init] autorelease]; 3312 textfield = [[UITextField alloc] init];
3302 [self addSubview:textfield]; 3313 [self addSubview:textfield];
3303 stepper = [[[DWStepper alloc] init] autorelease]; 3314 stepper = [[DWStepper alloc] init];
3304 [self addSubview:stepper]; 3315 [self addSubview:stepper];
3305 [stepper setParent:self]; 3316 [stepper setParent:self];
3306 [stepper setTextfield:textfield]; 3317 [stepper setTextfield:textfield];
3307 [textfield setText:[NSString stringWithFormat:@"%ld",(long)[stepper value]]]; 3318 [textfield setText:[NSString stringWithFormat:@"%ld",(long)[stepper value]]];
3308 [textfield setDelegate:self]; 3319 [textfield setDelegate:self];
3325 { 3336 {
3326 [textfield setText:[NSString stringWithFormat:@"%d", (int)[theStepper value]]]; 3337 [textfield setText:[NSString stringWithFormat:@"%d", (int)[theStepper value]]];
3327 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), _DW_EVENT_VALUE_CHANGED); 3338 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), _DW_EVENT_VALUE_CHANGED);
3328 } 3339 }
3329 -(void)setClickDefault:(id)input { clickDefault = input; } 3340 -(void)setClickDefault:(id)input { clickDefault = input; }
3330 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } 3341 -(void)dealloc
3342 {
3343 UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE);
3344 dw_signal_disconnect_by_window(self);
3345 [textfield removeFromSuperview];
3346 [textfield release];
3347 [stepper removeFromSuperview];
3348 [stepper release];
3349 [super dealloc];
3350 }
3331 @end 3351 @end
3332 3352
3333 API_AVAILABLE(ios(10.0)) 3353 API_AVAILABLE(ios(10.0))
3334 @interface DWUserNotificationCenterDelegate : NSObject <UNUserNotificationCenterDelegate> 3354 @interface DWUserNotificationCenterDelegate : NSObject <UNUserNotificationCenterDelegate>
3335 @end 3355 @end
3371 { 3391 {
3372 UIPickerView* pickerView; 3392 UIPickerView* pickerView;
3373 NSMutableArray* dataArray; 3393 NSMutableArray* dataArray;
3374 UIBarStyle toolbarStyle; 3394 UIBarStyle toolbarStyle;
3375 int selectedIndex; 3395 int selectedIndex;
3396 void *userdata;
3376 } 3397 }
3377 -(void)setToolbarStyle:(UIBarStyle)style; 3398 -(void)setToolbarStyle:(UIBarStyle)style;
3378 -(void)append:(NSString *)item; 3399 -(void)append:(NSString *)item;
3379 -(void)insert:(NSString *)item atIndex:(int)index; 3400 -(void)insert:(NSString *)item atIndex:(int)index;
3380 -(void)clear; 3401 -(void)clear;
3381 -(int)count; 3402 -(int)count;
3382 -(NSString *)getTextAtIndex:(int)index; 3403 -(NSString *)getTextAtIndex:(int)index;
3383 -(void)setText:(NSString *)item atIndex:(int)index; 3404 -(void)setText:(NSString *)item atIndex:(int)index;
3384 -(void)deleteAtIndex:(int)index; 3405 -(void)deleteAtIndex:(int)index;
3385 -(int)selectedIndex; 3406 -(int)selectedIndex;
3407 -(void *)userdata;
3408 -(void)setUserdata:(void *)input;
3386 @end 3409 @end
3387 3410
3388 @implementation DWComboBox 3411 @implementation DWComboBox
3389 -(id)init 3412 -(id)init
3390 { 3413 {
3521 [self setInputView:nil]; 3544 [self setInputView:nil];
3522 [self setInputAccessoryView:nil]; 3545 [self setInputAccessoryView:nil];
3523 return [super becomeFirstResponder]; 3546 return [super becomeFirstResponder];
3524 } 3547 }
3525 -(int)selectedIndex { return selectedIndex; } 3548 -(int)selectedIndex { return selectedIndex; }
3549 -(void *)userdata { return userdata; }
3550 -(void)setUserdata:(void *)input { userdata = input; }
3551 -(void)dealloc
3552 {
3553 UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE);
3554 dw_signal_disconnect_by_window(self);
3555 [dataArray release];
3556 [super dealloc];
3557 }
3526 @end 3558 @end
3527 3559
3528 /* Subclass for a MDI type 3560 /* Subclass for a MDI type
3529 * This is just a box for display purposes... but it is a 3561 * This is just a box for display purposes... but it is a
3530 * unique class so it can be identified when creating windows. 3562 * unique class so it can be identified when creating windows.
4175 button2 = @"No"; 4207 button2 = @"No";
4176 button3 = @"Cancel"; 4208 button3 = @"Cancel";
4177 } 4209 }
4178 4210
4179 va_start(args, format); 4211 va_start(args, format);
4180 mtext = [[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args] autorelease]; 4212 mtext = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args];
4181 va_end(args); 4213 va_end(args);
4182 4214
4183 params = [NSMutableArray arrayWithObjects:mtitle, mtext, [NSNumber numberWithInteger:mstyle], button1, button2, button3, nil]; 4215 params = [NSMutableArray arrayWithObjects:mtitle, mtext, [NSNumber numberWithInteger:mstyle], button1, button2, button3, nil];
4184 [DWObj safeCall:@selector(messageBox:) withObject:params]; 4216 [DWObj safeCall:@selector(messageBox:) withObject:params];
4185 in_mb = FALSE; 4217 in_mb = FALSE;
4368 DWBox *tmpbox = dw_box_new(DW_VERT, 0); 4400 DWBox *tmpbox = dw_box_new(DW_VERT, 0);
4369 dw_box_pack_start(tmpbox, box, 1, 1, TRUE, TRUE, 0); 4401 dw_box_pack_start(tmpbox, box, 1, 1, TRUE, TRUE, 0);
4370 [scrollbox setBox:box]; 4402 [scrollbox setBox:box];
4371 [scrollbox addSubview:tmpbox]; 4403 [scrollbox addSubview:tmpbox];
4372 [scrollbox setScrollEnabled:YES]; 4404 [scrollbox setScrollEnabled:YES];
4373 [tmpbox autorelease]; 4405 [tmpbox release];
4374 DW_FUNCTION_RETURN_THIS(scrollbox); 4406 DW_FUNCTION_RETURN_THIS(scrollbox);
4375 } 4407 }
4376 4408
4377 /* 4409 /*
4378 * Returns the position of the scrollbar in the scrollbox 4410 * Returns the position of the scrollbar in the scrollbox
5434 5466
5435 [cont setAllowsMultipleSelection:(multi ? YES : NO)]; 5467 [cont setAllowsMultipleSelection:(multi ? YES : NO)];
5436 [cont setDataSource:cont]; 5468 [cont setDataSource:cont];
5437 [cont setDelegate:cont]; 5469 [cont setDelegate:cont];
5438 [cont setTag:cid]; 5470 [cont setTag:cid];
5439 [cont autorelease];
5440 [cont setRowBgOdd:DW_RGB_TRANSPARENT andEven:DW_RGB_TRANSPARENT]; 5471 [cont setRowBgOdd:DW_RGB_TRANSPARENT andEven:DW_RGB_TRANSPARENT];
5441 return cont; 5472 return cont;
5442 } 5473 }
5443 5474
5444 /* 5475 /*
5868 DW_FUNCTION_DEFINITION(dw_combobox_new, HWND, const char *text, ULONG cid) 5899 DW_FUNCTION_DEFINITION(dw_combobox_new, HWND, const char *text, ULONG cid)
5869 DW_FUNCTION_ADD_PARAM2(text, cid) 5900 DW_FUNCTION_ADD_PARAM2(text, cid)
5870 DW_FUNCTION_RETURN(dw_combobox_new, HWND) 5901 DW_FUNCTION_RETURN(dw_combobox_new, HWND)
5871 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) 5902 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG)
5872 { 5903 {
5873 DWComboBox *combo = [[DWComboBox alloc] init]; 5904 DWComboBox *combo = [[[DWComboBox alloc] init] retain];
5874 if(text) 5905 if(text)
5875 [combo setText:[NSString stringWithUTF8String:text]]; 5906 [combo setText:[NSString stringWithUTF8String:text]];
5876 [combo setTag:cid]; 5907 [combo setTag:cid];
5877 DW_FUNCTION_RETURN_THIS(combo); 5908 DW_FUNCTION_RETURN_THIS(combo);
5878 } 5909 }
5898 5929
5899 size.width = size.height; 5930 size.width = size.height;
5900 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; 5931 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
5901 [mle setScrollEnabled:YES]; 5932 [mle setScrollEnabled:YES];
5902 [mle setTag:cid]; 5933 [mle setTag:cid];
5903 [mle autorelease];
5904 DW_FUNCTION_RETURN_THIS(mle); 5934 DW_FUNCTION_RETURN_THIS(mle);
5905 } 5935 }
5906 5936
5907 /* 5937 /*
5908 * Adds text to an MLE box and returns the current point. 5938 * Adds text to an MLE box and returns the current point.
6698 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) 6728 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG)
6699 { 6729 {
6700 DW_FUNCTION_INIT; 6730 DW_FUNCTION_INIT;
6701 DWTree *tree = [[[DWTree alloc] init] retain]; 6731 DWTree *tree = [[[DWTree alloc] init] retain];
6702 [tree setTag:cid]; 6732 [tree setTag:cid];
6703 [tree autorelease];
6704 DW_FUNCTION_RETURN_THIS(tree); 6733 DW_FUNCTION_RETURN_THIS(tree);
6705 } 6734 }
6706 6735
6707 /* 6736 /*
6708 * Inserts an item into a tree window (widget) after another item. 6737 * Inserts an item into a tree window (widget) after another item.
6734 else 6763 else
6735 [treeparent appendChild:treeitem]; 6764 [treeparent appendChild:treeitem];
6736 } 6765 }
6737 else 6766 else
6738 [tree insertTreeItem:treeitem]; 6767 [tree insertTreeItem:treeitem];
6739 [treeitem autorelease];
6740 DW_FUNCTION_RETURN_THIS(treeitem); 6768 DW_FUNCTION_RETURN_THIS(treeitem);
6741 } 6769 }
6742 6770
6743 /* 6771 /*
6744 * Inserts an item into a tree window (widget). 6772 * Inserts an item into a tree window (widget).
8041 */ 8069 */
8042 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename) 8070 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename)
8043 { 8071 {
8044 HPIXMAP pixmap; 8072 HPIXMAP pixmap;
8045 DW_LOCAL_POOL_IN; 8073 DW_LOCAL_POOL_IN;
8046 char *ext = _dw_get_image_extension( filename ); 8074 char *ext = _dw_get_image_extension(filename);
8047 8075
8048 if(!(pixmap = calloc(1,sizeof(struct _hpixmap)))) 8076 if(!(pixmap = calloc(1,sizeof(struct _hpixmap))))
8049 { 8077 {
8050 DW_LOCAL_POOL_OUT; 8078 DW_LOCAL_POOL_OUT;
8051 return NULL; 8079 return NULL;
8052 } 8080 }
8053 NSString *nstr = [ NSString stringWithUTF8String:filename ]; 8081 NSString *nstr = [ NSString stringWithUTF8String:filename ];
8054 UIImage *tmpimage = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; 8082 UIImage *tmpimage = [[UIImage alloc] initWithContentsOfFile:nstr];
8055 if(!tmpimage && ext) 8083 if(!tmpimage && ext)
8056 { 8084 {
8057 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; 8085 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]];
8058 tmpimage = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; 8086 tmpimage = [[UIImage alloc] initWithContentsOfFile:nstr];
8059 } 8087 }
8060 if(!tmpimage) 8088 if(!tmpimage)
8061 { 8089 {
8062 DW_LOCAL_POOL_OUT; 8090 DW_LOCAL_POOL_OUT;
8063 return NULL; 8091 return NULL;
8064 } 8092 }
8065 pixmap->width = [tmpimage size].width; 8093 pixmap->width = [tmpimage size].width;
8066 pixmap->height = [tmpimage size].height; 8094 pixmap->height = [tmpimage size].height;
8067 pixmap->image = [[DWImage alloc] initWithUIImage:tmpimage]; 8095 pixmap->image = [[[DWImage alloc] initWithUIImage:tmpimage] retain];
8068 pixmap->handle = handle; 8096 pixmap->handle = handle;
8069 DW_LOCAL_POOL_OUT; 8097 DW_LOCAL_POOL_OUT;
8070 return pixmap; 8098 return pixmap;
8071 } 8099 }
8072 8100
8089 { 8117 {
8090 DW_LOCAL_POOL_OUT; 8118 DW_LOCAL_POOL_OUT;
8091 return NULL; 8119 return NULL;
8092 } 8120 }
8093 NSData *thisdata = [NSData dataWithBytes:data length:len]; 8121 NSData *thisdata = [NSData dataWithBytes:data length:len];
8094 UIImage *tmpimage = [[[UIImage alloc] initWithData:thisdata] autorelease]; 8122 UIImage *tmpimage = [[UIImage alloc] initWithData:thisdata];
8095 if(!tmpimage) 8123 if(!tmpimage)
8096 { 8124 {
8097 DW_LOCAL_POOL_OUT; 8125 DW_LOCAL_POOL_OUT;
8098 return NULL; 8126 return NULL;
8099 } 8127 }
8100 pixmap->width = [tmpimage size].width; 8128 pixmap->width = [tmpimage size].width;
8101 pixmap->height = [tmpimage size].height; 8129 pixmap->height = [tmpimage size].height;
8102 pixmap->image = [[DWImage alloc] initWithUIImage:tmpimage]; 8130 pixmap->image = [[[DWImage alloc] initWithUIImage:tmpimage] retain];
8103 pixmap->handle = handle; 8131 pixmap->handle = handle;
8104 DW_LOCAL_POOL_OUT; 8132 DW_LOCAL_POOL_OUT;
8105 return pixmap; 8133 return pixmap;
8106 } 8134 }
8107 8135
8325 NSDate *date; 8353 NSDate *date;
8326 char buffer[101] = {0}; 8354 char buffer[101] = {0};
8327 8355
8328 snprintf(buffer, 100, "%04d-%02d-%02d", year, month, day); 8356 snprintf(buffer, 100, "%04d-%02d-%02d", year, month, day);
8329 8357
8330 NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; 8358 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
8331 dateFormatter.dateFormat = @"yyyy-MM-dd"; 8359 dateFormatter.dateFormat = @"yyyy-MM-dd";
8332 8360
8333 date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]]; 8361 date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]];
8334 [calendar setDate:date]; 8362 [calendar setDate:date];
8335 [date release]; 8363 [date release];
8792 DW_FUNCTION_RETURN(dw_notebook_page_new, ULONG) 8820 DW_FUNCTION_RETURN(dw_notebook_page_new, ULONG)
8793 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, DW_UNUSED(flags), ULONG, front, int) 8821 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, DW_UNUSED(flags), ULONG, front, int)
8794 { 8822 {
8795 DWNotebook *notebook = handle; 8823 DWNotebook *notebook = handle;
8796 NSInteger page = [notebook pageid]; 8824 NSInteger page = [notebook pageid];
8797 DWNotebookPage *notepage = [[[DWNotebookPage alloc] init] retain]; 8825 DWNotebookPage *notepage = [[DWNotebookPage alloc] init];
8798 NSMutableArray<DWNotebookPage *> *views = [notebook views]; 8826 NSMutableArray<DWNotebookPage *> *views = [notebook views];
8799 unsigned long retval; 8827 unsigned long retval;
8800 8828
8801 [notepage setPageid:(int)page]; 8829 [notepage setPageid:(int)page];
8802 if(front) 8830 if(front)
8808 { 8836 {
8809 [[notebook tabs] insertSegmentWithTitle:@"" atIndex:[[notebook tabs] numberOfSegments] animated:NO]; 8837 [[notebook tabs] insertSegmentWithTitle:@"" atIndex:[[notebook tabs] numberOfSegments] animated:NO];
8810 [views addObject:notepage]; 8838 [views addObject:notepage];
8811 } 8839 }
8812 [notebook addSubview:notepage]; 8840 [notebook addSubview:notepage];
8813 [notepage autorelease];
8814 [notebook setPageid:(int)(page+1)]; 8841 [notebook setPageid:(int)(page+1)];
8815 8842
8816 if([views count] != 1) 8843 if([views count] != 1)
8817 { 8844 {
8818 /* Otherwise hide the page */ 8845 /* Otherwise hide the page */
9524 } 9551 }
9525 9552
9526 if(index != -1) 9553 if(index != -1)
9527 { 9554 {
9528 [object removeFromSuperview]; 9555 [object removeFromSuperview];
9556 [object release];
9529 9557
9530 if(thisbox->count > 1) 9558 if(thisbox->count > 1)
9531 { 9559 {
9532 tmpitem = calloc(sizeof(Item), (thisbox->count-1)); 9560 tmpitem = calloc(sizeof(Item), (thisbox->count-1));
9533 9561
9770 { 9798 {
9771 if(data) 9799 if(data)
9772 { 9800 {
9773 DW_LOCAL_POOL_IN; 9801 DW_LOCAL_POOL_IN;
9774 NSData *thisdata = [NSData dataWithBytes:data length:len]; 9802 NSData *thisdata = [NSData dataWithBytes:data length:len];
9775 UIImage *pixmap = [[[UIImage alloc] initWithData:thisdata] autorelease]; 9803 UIImage *pixmap = [[UIImage alloc] initWithData:thisdata];
9776 9804
9777 if(pixmap) 9805 if(pixmap)
9778 { 9806 {
9779 if([object isMemberOfClass:[DWButton class]]) 9807 if([object isMemberOfClass:[DWButton class]])
9780 { 9808 {
9826 if(filename) 9854 if(filename)
9827 { 9855 {
9828 char *ext = _dw_get_image_extension( filename ); 9856 char *ext = _dw_get_image_extension( filename );
9829 NSString *nstr = [ NSString stringWithUTF8String:filename ]; 9857 NSString *nstr = [ NSString stringWithUTF8String:filename ];
9830 9858
9831 bitmap = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; 9859 bitmap = [[UIImage alloc] initWithContentsOfFile:nstr];
9832 9860
9833 if(!bitmap && ext) 9861 if(!bitmap && ext)
9834 { 9862 {
9835 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; 9863 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]];
9836 bitmap = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; 9864 bitmap = [[UIImage alloc] initWithContentsOfFile:nstr];
9837 } 9865 }
9838 } 9866 }
9839 if(!bitmap && resid > 0 && resid < 65536) 9867 if(!bitmap && resid > 0 && resid < 65536)
9840 { 9868 {
9841 bitmap = _dw_icon_load(resid); 9869 bitmap = _dw_icon_load(resid);