QTfrontend/main.cpp
changeset 8187 fa725fe25708
parent 8117 329d9756b57c
child 8206 1633a6510834
equal deleted inserted replaced
8186:4ff8690df1b0 8187:fa725fe25708
   103             return false;
   103             return false;
   104         }
   104         }
   105     return true;
   105     return true;
   106 }
   106 }
   107 
   107 
       
   108 #ifdef __APPLE__
       
   109 static CocoaInitializer *cocoaInit = NULL;
       
   110 // Function to be called at end of program's termination on OS X to release
       
   111 // the NSAutoReleasePool contained within the CocoaInitializer.
       
   112 void releaseCocoaPool(void)
       
   113 {
       
   114     if (cocoaInit != NULL)
       
   115     {
       
   116         delete cocoaInit;
       
   117         cocoaInit = NULL;
       
   118     }
       
   119 }
       
   120 #endif
       
   121 
   108 int main(int argc, char *argv[])
   122 int main(int argc, char *argv[])
   109 {
   123 {
       
   124 #ifdef __APPLE__
       
   125     // This creates the autoreleasepool that prevents leaking, and destroys it only on exit
       
   126     cocoaInit = new CocoaInitializer();
       
   127     atexit(releaseCocoaPool);
       
   128 #endif
       
   129 
   110     HWApplication app(argc, argv);
   130     HWApplication app(argc, argv);
   111 
   131 
   112     FileEngineHandler engine(argv[0]);
   132     FileEngineHandler engine(argv[0]);
   113 
   133 
   114     flib_init();
   134     flib_init();
   251     {
   271     {
   252         QSettings registry_hklm("HKEY_LOCAL_MACHINE", QSettings::NativeFormat);
   272         QSettings registry_hklm("HKEY_LOCAL_MACHINE", QSettings::NativeFormat);
   253         registry_hklm.setValue("Software/Hedgewars/Frontend", bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe");
   273         registry_hklm.setValue("Software/Hedgewars/Frontend", bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe");
   254         registry_hklm.setValue("Software/Hedgewars/Path", bindir->absolutePath().replace("/", "\\"));
   274         registry_hklm.setValue("Software/Hedgewars/Path", bindir->absolutePath().replace("/", "\\"));
   255     }
   275     }
   256 #endif
       
   257 #ifdef __APPLE__
       
   258     // this creates the autoreleasepool that prevents leaking
       
   259     CocoaInitializer initializer;
       
   260 #endif
   276 #endif
   261 
   277 
   262     QString style = "";
   278     QString style = "";
   263     QString fname;
   279     QString fname;
   264 
   280