forked from 0ad/0ad
wdbg: fix crash when exiting abnormally (alt+f4) - was erasing elements from container while iterating through it
win internal files: slight changes while looking through This was SVN commit r1850.
This commit is contained in:
parent
f2758699d6
commit
f25f6a2d70
@ -677,11 +677,11 @@ static int ZArchive_reload(ZArchive* za, const char* fn, Handle)
|
||||
size_t size;
|
||||
err = file_map(&za->f, file, size);
|
||||
if(err < 0)
|
||||
goto exit_close;
|
||||
goto fail_close;
|
||||
|
||||
err = lookup_init(&za->li, (u8*)file, size);
|
||||
if(err < 0)
|
||||
goto exit_unmap_close;
|
||||
goto fail_unmap_close;
|
||||
|
||||
file_unmap(&za->f);
|
||||
// we map the file only for convenience when loading;
|
||||
@ -690,9 +690,9 @@ static int ZArchive_reload(ZArchive* za, const char* fn, Handle)
|
||||
za->is_open = true;
|
||||
return 0;
|
||||
|
||||
exit_unmap_close:
|
||||
fail_unmap_close:
|
||||
file_unmap(&za->f);
|
||||
exit_close:
|
||||
fail_close:
|
||||
file_close(&za->f);
|
||||
|
||||
// don't complain here either; this happens when vfs_mount
|
||||
|
@ -1301,7 +1301,7 @@ static void set_exception_handler()
|
||||
|
||||
|
||||
|
||||
#ifndef NO_0AD_EXCEPTION
|
||||
#ifdef EXCEPTION_HACK_0AD
|
||||
|
||||
|
||||
|
||||
@ -1596,5 +1596,5 @@ int debug_main_exception_filter(unsigned int UNUSEDPARAM(code), PEXCEPTION_POINT
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#endif // #ifndef NO_0AD_EXCEPTION
|
||||
#endif // #ifdef EXCEPTION_HACK_0AD
|
||||
|
||||
|
@ -79,9 +79,8 @@ struct Watch;
|
||||
typedef std::map<intptr_t, Watch*> Watches;
|
||||
typedef Watches::iterator WatchIt;
|
||||
|
||||
// list of all active watches to detect duplicates and
|
||||
// for easier cleanup. only store pointer in container -
|
||||
// they're not copy-equivalent.
|
||||
// list of all active watches to detect duplicates and for easier cleanup.
|
||||
// only store pointer in container - they're not copy-equivalent.
|
||||
static Watches watches;
|
||||
|
||||
// don't worry about size; heap-allocated.
|
||||
@ -120,7 +119,7 @@ struct Watch
|
||||
CloseHandle(hDir);
|
||||
hDir = INVALID_HANDLE_VALUE;
|
||||
|
||||
watches.erase(reqnum);
|
||||
watches[reqnum] = 0;
|
||||
}
|
||||
};
|
||||
|
||||
@ -150,10 +149,12 @@ static int wdir_watch_shutdown()
|
||||
CloseHandle(hIOCP);
|
||||
hIOCP = INVALID_HANDLE_VALUE;
|
||||
|
||||
// free all (dynamically allocated) Watch-es
|
||||
// free all (dynamically allocated) Watch objects
|
||||
for(WatchIt it = watches.begin(); it != watches.end(); ++it)
|
||||
delete it->second;
|
||||
|
||||
watches.clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ PfnDliHook __pfnDliFailureHook2;
|
||||
|
||||
|
||||
#pragma data_seg(".LIB$WTY") // must be last, since DLLs are unloaded here
|
||||
WIN_REGISTER_FUNC(wdelayload_shutdown);
|
||||
WIN_REGISTER_FUNC(wdll_shutdown);
|
||||
#pragma data_seg()
|
||||
|
||||
|
||||
@ -502,7 +502,7 @@ __FUnloadDelayLoadedDLL2(LPCSTR szDll) {
|
||||
|
||||
return fRet;
|
||||
}
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
HRESULT WINAPI
|
||||
__HrLoadAllImportsForDll(LPCSTR szDll) {
|
||||
@ -559,10 +559,10 @@ __HrLoadAllImportsForDll(LPCSTR szDll) {
|
||||
}
|
||||
return hrRet;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
static int wdelayload_shutdown()
|
||||
static int wdll_shutdown()
|
||||
{
|
||||
PUnloadInfo pui;
|
||||
|
||||
|
@ -268,7 +268,7 @@ static void call_func_tbl(_PIFV* begin, _PIFV* end)
|
||||
|
||||
|
||||
// locking for win-specific code
|
||||
// several init functions are called on-demand, possibly from constructors.
|
||||
// several init functions are before _cinit.
|
||||
// can't guarantee POSIX static mutex init has been done by then.
|
||||
|
||||
|
||||
|
@ -110,10 +110,8 @@ int pthread_create(pthread_t* thread, const void* attr, void*(*func)(void*), voi
|
||||
{
|
||||
UNUSED(attr);
|
||||
|
||||
// notes:
|
||||
// - don't call via asm: _beginthreadex might be a func ptr (if DLL CRT).
|
||||
// - don't stack-allocate param: thread_start might not be called
|
||||
// in the new thread before we exit this stack frame.
|
||||
// note: don't stack-allocate param: thread_start might not be called
|
||||
// in the new thread before we exit this stack frame.
|
||||
ThreadParam* param = new ThreadParam(func, user_arg);
|
||||
*thread = (pthread_t)_beginthreadex(0, 0, thread_start, (void*)param, 0, 0);
|
||||
return 0;
|
||||
|
@ -45,8 +45,7 @@ static int dll_refs;
|
||||
|
||||
|
||||
// called from delay loader the first time a wsock function is called
|
||||
// (shortly before the actual wsock function is called)
|
||||
// and also from the getaddrinfo hooks.
|
||||
// (shortly before the actual wsock function is called).
|
||||
static int wsock_init()
|
||||
{
|
||||
hWs2_32Dll = LoadLibrary("ws2_32.dll");
|
||||
|
Loading…
Reference in New Issue
Block a user