Mercurial > dwindows
changeset 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 | b6ae5b017b28 |
children | 0adf73d5d8c2 |
files | mac/dw.m |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Tue Aug 02 07:27:13 2022 +0000 +++ b/mac/dw.m Tue Aug 02 08:52:13 2022 +0000 @@ -12621,24 +12621,28 @@ if(!_dw_bundle_path[0]) getcwd(_dw_bundle_path, PATH_MAX); - /* Get the operating system version */ - NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString]; - const char *versionstr = [version UTF8String]; - sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild); - /* Set the locale... if it is UTF-8 pass it + /* Set the locale... if it is UTF-8 pass it * directly, otherwise specify UTF-8 explicitly. */ setlocale(LC_ALL, lang && strstr(lang, ".UTF-8") ? lang : "UTF-8"); - /* Create the application object */ - _dw_app_init(); - /* Create object for handling timers */ - DWHandler = [[DWTimerHandler alloc] init]; + /* If we aren't using garbage collection we need autorelease pools */ #if !defined(GARBAGE_COLLECT) pthread_key_create(&_dw_pool_key, NULL); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; pthread_setspecific(_dw_pool_key, pool); #endif + + /* Get the operating system version */ + NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString]; + const char *versionstr = [version UTF8String]; + sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild); + + /* Create the application object */ + _dw_app_init(); + /* Create object for handling timers */ + DWHandler = [[DWTimerHandler alloc] init]; + pthread_key_create(&_dw_fg_color_key, NULL); pthread_key_create(&_dw_bg_color_key, NULL); _dw_init_colors();