Mercurial > dwindows
comparison mac/dw.m @ 2943:fbf43ea71c8e
Mac: Fix a double free error caused by the dw_debug() changes.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 02 Jan 2023 01:32:18 +0000 |
parents | 7d3276f80132 |
children | 7e7b38472c3d |
comparison
equal
deleted
inserted
replaced
2942:63d7baebb0d4 | 2943:fbf43ea71c8e |
---|---|
4347 * format: printf style format string. | 4347 * format: printf style format string. |
4348 * ...: Additional variables for use in the format. | 4348 * ...: Additional variables for use in the format. |
4349 */ | 4349 */ |
4350 void API dw_debug(const char *format, ...) | 4350 void API dw_debug(const char *format, ...) |
4351 { | 4351 { |
4352 va_list args; | 4352 va_list args; |
4353 | 4353 |
4354 va_start(args, format); | 4354 va_start(args, format); |
4355 dw_vdebug(format, args); | 4355 dw_vdebug(format, args); |
4356 va_end(args); | 4356 va_end(args); |
4357 } | 4357 } |
4358 | 4358 |
4359 void API dw_vdebug(const char *format, va_list args) | 4359 void API dw_vdebug(const char *format, va_list args) |
4360 { | 4360 { |
4361 NSString *nformat = [[NSString stringWithUTF8String:format] autorelease]; | 4361 DW_LOCAL_POOL_IN; |
4362 | 4362 NSString *nformat = [NSString stringWithUTF8String:format]; |
4363 NSLogv(nformat, args); | 4363 |
4364 NSLogv(nformat, args); | |
4365 DW_LOCAL_POOL_OUT; | |
4364 } | 4366 } |
4365 | 4367 |
4366 /* | 4368 /* |
4367 * Displays a Message Box with given text and title.. | 4369 * Displays a Message Box with given text and title.. |
4368 * Parameters: | 4370 * Parameters: |
4382 return rc; | 4384 return rc; |
4383 } | 4385 } |
4384 | 4386 |
4385 int API dw_vmessagebox(const char *title, int flags, const char *format, va_list args) | 4387 int API dw_vmessagebox(const char *title, int flags, const char *format, va_list args) |
4386 { | 4388 { |
4389 DW_LOCAL_POOL_IN; | |
4387 NSInteger iResponse; | 4390 NSInteger iResponse; |
4388 NSString *button1 = @"OK"; | 4391 NSString *button1 = @"OK"; |
4389 NSString *button2 = nil; | 4392 NSString *button2 = nil; |
4390 NSString *button3 = nil; | 4393 NSString *button3 = nil; |
4391 NSString *mtitle = [NSString stringWithUTF8String:title]; | 4394 NSString *mtitle = [NSString stringWithUTF8String:title]; |
4435 } | 4438 } |
4436 return DW_MB_RETURN_NO; | 4439 return DW_MB_RETURN_NO; |
4437 case NSAlertThirdButtonReturn: /* user pressed the third button */ | 4440 case NSAlertThirdButtonReturn: /* user pressed the third button */ |
4438 return DW_MB_RETURN_CANCEL; | 4441 return DW_MB_RETURN_CANCEL; |
4439 } | 4442 } |
4443 DW_LOCAL_POOL_OUT; | |
4440 return 0; | 4444 return 0; |
4441 } | 4445 } |
4442 | 4446 |
4443 /* | 4447 /* |
4444 * Opens a file dialog and queries user selection. | 4448 * Opens a file dialog and queries user selection. |