mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 20:45:36 +08:00
tune order of terminating functions
This commit is contained in:
@@ -161,7 +161,7 @@ void mg_TerminateDesktop (void)
|
||||
DestroyFreeClipRectList (&sg_FreeClipRectList);
|
||||
DestroyFreeClipRectList (&sg_FreeInvRectList);
|
||||
|
||||
mg_TerminateSystemRes ();
|
||||
//mg_TerminateSystemRes ();
|
||||
//dongjunjie avoid double free
|
||||
__mg_dsk_win = 0;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ void mg_TerminateDesktop (void)
|
||||
// Since 5.0.0
|
||||
__mg_free_hook_wins (0);
|
||||
|
||||
mg_TerminateSystemRes ();
|
||||
// mg_TerminateSystemRes ();
|
||||
// dongjunjie avoid double free
|
||||
__mg_dsk_win = 0;
|
||||
}
|
||||
|
||||
+12
-14
@@ -121,18 +121,21 @@ int InitGUI (int argc, const char* agr[])
|
||||
_ERR_PRINTF ("KERNEL>InitGUI: failed to initialize slice allocator!\n");
|
||||
return step;
|
||||
}
|
||||
atexit (mg_TerminateSliceAllocator);
|
||||
|
||||
if (!mg_InitFixStr ()) {
|
||||
err_message (step, "Can not initialize Fixed String heap!\n");
|
||||
return step;
|
||||
}
|
||||
step++;
|
||||
atexit (mg_TerminateFixStr);
|
||||
|
||||
if (!mg_InitMisc ()) {
|
||||
err_message (step, "Can not initialize miscellous things!");
|
||||
return step;
|
||||
}
|
||||
step++;
|
||||
atexit (mg_TerminateMisc);
|
||||
|
||||
/* Init GAL engine. */
|
||||
switch (mg_InitGAL (engine, mode)) {
|
||||
@@ -176,9 +179,6 @@ int InitGUI (int argc, const char* agr[])
|
||||
|
||||
void TerminateGUI (int rcByGUI)
|
||||
{
|
||||
mg_TerminateMisc ();
|
||||
mg_TerminateFixStr ();
|
||||
mg_TerminateSliceAllocator();
|
||||
}
|
||||
|
||||
#warning ExitGUISafely?
|
||||
@@ -352,6 +352,7 @@ int InitGUI (int argc, const char* agr[])
|
||||
return step;
|
||||
}
|
||||
step++;
|
||||
atexit (mg_TerminateSliceAllocator);
|
||||
|
||||
if (!mg_InitFixStr ()) {
|
||||
err_message (step, "Can not initialize Fixed String heap!\n");
|
||||
@@ -434,16 +435,6 @@ int InitGUI (int argc, const char* agr[])
|
||||
#endif
|
||||
InstallSEGVHandler ();
|
||||
|
||||
/** initialize icon bitmap resource.*/
|
||||
if (mg_InitSystemRes () == FALSE) {
|
||||
_ERR_PRINTF ("KERNEL>IniGUI: init system res error!\n");
|
||||
return step;
|
||||
}
|
||||
step++;
|
||||
/* DK[11/29/10]: For fix bug 4440, avoid double free. */
|
||||
/* atexit (mg_TerminateSystemRes);
|
||||
*/
|
||||
|
||||
if (!mg_InitGDI ()) {
|
||||
err_message (step, "Initialization of GDI resource failure!\n");
|
||||
return step;
|
||||
@@ -459,6 +450,14 @@ int InitGUI (int argc, const char* agr[])
|
||||
step++;
|
||||
atexit (mg_TerminateScreenDC);
|
||||
|
||||
/** initialize icon bitmap resource.*/
|
||||
if (mg_InitSystemRes () == FALSE) {
|
||||
_ERR_PRINTF ("KERNEL>IniGUI: init system res error!\n");
|
||||
return step;
|
||||
}
|
||||
step++;
|
||||
atexit (mg_TerminateSystemRes);
|
||||
|
||||
#if 0
|
||||
g_rcScr.left = 0;
|
||||
g_rcScr.top = 0;
|
||||
@@ -623,7 +622,6 @@ void TerminateGUI (int rcByGUI)
|
||||
deleteThreadInfoKey();
|
||||
#endif
|
||||
|
||||
mg_TerminateSliceAllocator();
|
||||
}
|
||||
#endif /* ifndef _MG_MINIMALGDI */
|
||||
|
||||
|
||||
+11
-10
@@ -473,15 +473,6 @@ int GUIAPI InitGUI (int args, const char *agr[])
|
||||
InstallSEGVHandler ();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Load system resource here.
|
||||
*/
|
||||
step++;
|
||||
if (!mg_InitSystemRes ()) {
|
||||
_ERR_PRINTF ("KERNEL>InitGUI: Can not init system resource!\n");
|
||||
goto failure1;
|
||||
}
|
||||
|
||||
/* Init GDI. */
|
||||
step++;
|
||||
if(!mg_InitGDI()) {
|
||||
@@ -496,6 +487,15 @@ int GUIAPI InitGUI (int args, const char *agr[])
|
||||
goto failure1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load system resource here.
|
||||
*/
|
||||
step++;
|
||||
if (!mg_InitSystemRes ()) {
|
||||
_ERR_PRINTF ("KERNEL>InitGUI: Can not init system resource!\n");
|
||||
goto failure1;
|
||||
}
|
||||
|
||||
__mg_license_create();
|
||||
__mg_splash_draw_framework();
|
||||
|
||||
@@ -647,8 +647,9 @@ void GUIAPI TerminateGUI (int not_used)
|
||||
mg_TerminateLWEvent ();
|
||||
|
||||
mg_TerminateScreenDC ();
|
||||
mg_TerminateGDI ();
|
||||
mg_TerminateLFManager ();
|
||||
mg_TerminateSystemRes ();
|
||||
mg_TerminateGDI ();
|
||||
mg_TerminateGAL ();
|
||||
|
||||
#ifdef _MGHAVE_ADV_2DAPI
|
||||
|
||||
+4
-3
@@ -455,9 +455,6 @@ void TerminateResManager()
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Since 5.0.0, destroy the map for system bitmaps */
|
||||
__mg_map_destroy (__mg_sys_bmp_map);
|
||||
|
||||
//delete all entries
|
||||
RES_LOCK();
|
||||
for(i=0; i<hash_table.size; i++){
|
||||
@@ -487,6 +484,10 @@ void TerminateResManager()
|
||||
user_types = NULL;
|
||||
user_type_count = 0;
|
||||
UNINIT_LOCKER();
|
||||
|
||||
/* Since 5.0.0, destroy the map for system bitmaps */
|
||||
__mg_map_destroy (__mg_sys_bmp_map);
|
||||
|
||||
}
|
||||
|
||||
const char* __sysres_get_system_res_path()
|
||||
|
||||
Reference in New Issue
Block a user