Mercurial > dwindows
comparison mac/dw.m @ 2821:3731f21dd678
Mac: Fix NSAutoreleaseNoPool() console warnings on ancient MacOS versions,
by rearranging the order of things in dw_init().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 02 Aug 2022 08:52:13 +0000 |
parents | 4521f014bb17 |
children | b1ff739d0dbc |
comparison
equal
deleted
inserted
replaced
2820:b6ae5b017b28 | 2821:3731f21dd678 |
---|---|
12619 | 12619 |
12620 /* Just in case we can't obtain a path */ | 12620 /* Just in case we can't obtain a path */ |
12621 if(!_dw_bundle_path[0]) | 12621 if(!_dw_bundle_path[0]) |
12622 getcwd(_dw_bundle_path, PATH_MAX); | 12622 getcwd(_dw_bundle_path, PATH_MAX); |
12623 | 12623 |
12624 /* Get the operating system version */ | 12624 /* Set the locale... if it is UTF-8 pass it |
12625 NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString]; | |
12626 const char *versionstr = [version UTF8String]; | |
12627 sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild); | |
12628 /* Set the locale... if it is UTF-8 pass it | |
12629 * directly, otherwise specify UTF-8 explicitly. | 12625 * directly, otherwise specify UTF-8 explicitly. |
12630 */ | 12626 */ |
12631 setlocale(LC_ALL, lang && strstr(lang, ".UTF-8") ? lang : "UTF-8"); | 12627 setlocale(LC_ALL, lang && strstr(lang, ".UTF-8") ? lang : "UTF-8"); |
12632 /* Create the application object */ | 12628 |
12633 _dw_app_init(); | |
12634 /* Create object for handling timers */ | |
12635 DWHandler = [[DWTimerHandler alloc] init]; | |
12636 /* If we aren't using garbage collection we need autorelease pools */ | 12629 /* If we aren't using garbage collection we need autorelease pools */ |
12637 #if !defined(GARBAGE_COLLECT) | 12630 #if !defined(GARBAGE_COLLECT) |
12638 pthread_key_create(&_dw_pool_key, NULL); | 12631 pthread_key_create(&_dw_pool_key, NULL); |
12639 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | 12632 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
12640 pthread_setspecific(_dw_pool_key, pool); | 12633 pthread_setspecific(_dw_pool_key, pool); |
12641 #endif | 12634 #endif |
12635 | |
12636 /* Get the operating system version */ | |
12637 NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString]; | |
12638 const char *versionstr = [version UTF8String]; | |
12639 sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild); | |
12640 | |
12641 /* Create the application object */ | |
12642 _dw_app_init(); | |
12643 /* Create object for handling timers */ | |
12644 DWHandler = [[DWTimerHandler alloc] init]; | |
12645 | |
12642 pthread_key_create(&_dw_fg_color_key, NULL); | 12646 pthread_key_create(&_dw_fg_color_key, NULL); |
12643 pthread_key_create(&_dw_bg_color_key, NULL); | 12647 pthread_key_create(&_dw_bg_color_key, NULL); |
12644 _dw_init_colors(); | 12648 _dw_init_colors(); |
12645 /* Create a default main menu, with just the application menu */ | 12649 /* Create a default main menu, with just the application menu */ |
12646 DWMainMenu = _dw_generate_main_menu(); | 12650 DWMainMenu = _dw_generate_main_menu(); |