зеркало из https://github.com/mozilla/pjs.git
179151: Need to call FreeLibrary()
We call LoadLibrary(); but need to call FreeLibrary() upon shutdown. Impact only Windows platforms only /r=shanjian; /sr=kin
This commit is contained in:
Родитель
dfbd8b0bae
Коммит
22508a6c50
|
@ -379,6 +379,17 @@ ATOM WINAPI nsRegisterClass(const WNDCLASSW *aClassW)
|
|||
return RegisterClassA(&wClass);
|
||||
}
|
||||
|
||||
BOOL WINAPI nsUnregisterClass(LPCWSTR aClassW, HINSTANCE aInst)
|
||||
{
|
||||
char classA[MAX_PATH+1];
|
||||
|
||||
if (aClassW) {
|
||||
ConvertWtoA(aClassW, MAX_PATH, classA);
|
||||
return UnregisterClassA((LPCSTR)classA, aInst);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI nsSHGetPathFromIDList(LPCITEMIDLIST aIdList, LPWSTR aPathW)
|
||||
{
|
||||
char pathA[MAX_PATH+1];
|
||||
|
@ -424,6 +435,7 @@ LPITEMIDLIST WINAPI nsSHBrowseForFolder(LPBROWSEINFOW aBiW)
|
|||
return itemIdList;
|
||||
}
|
||||
|
||||
HMODULE nsToolkit::mShell32Module = NULL;
|
||||
NS_DefWindowProc nsToolkit::mDefWindowProc = DefWindowProcA;
|
||||
NS_CallWindowProc nsToolkit::mCallWindowProc = CallWindowProcA;
|
||||
NS_SetWindowLong nsToolkit::mSetWindowLong = SetWindowLongA;
|
||||
|
@ -437,6 +449,7 @@ NS_GetSaveFileName nsToolkit::mGetSaveFileName = nsGetSaveFileName;
|
|||
NS_GetClassName nsToolkit::mGetClassName = nsGetClassName;
|
||||
NS_CreateWindowEx nsToolkit::mCreateWindowEx = nsCreateWindowEx;
|
||||
NS_RegisterClass nsToolkit::mRegisterClass = nsRegisterClass;
|
||||
NS_UnregisterClass nsToolkit::mUnregisterClass = nsUnregisterClass;
|
||||
NS_SHGetPathFromIDList nsToolkit::mSHGetPathFromIDList = nsSHGetPathFromIDList;
|
||||
NS_SHBrowseForFolder nsToolkit::mSHBrowseForFolder = nsSHBrowseForFolder;
|
||||
|
||||
|
@ -594,14 +607,15 @@ nsToolkit::Startup(HMODULE hModule)
|
|||
nsToolkit::mGetClassName = GetClassNameW;
|
||||
nsToolkit::mCreateWindowEx = CreateWindowExW;
|
||||
nsToolkit::mRegisterClass = RegisterClassW;
|
||||
nsToolkit::mUnregisterClass = UnregisterClassW;
|
||||
// Explicit call of SHxxxW in Win95 makes moz fails to run (170969)
|
||||
// we use GetProcAddress() to hide
|
||||
HMODULE module = ::LoadLibrary("Shell32.dll");
|
||||
if (module) {
|
||||
nsToolkit::mSHGetPathFromIDList = (NS_SHGetPathFromIDList)GetProcAddress(module, "SHGetPathFromIDListW");
|
||||
nsToolkit::mShell32Module = ::LoadLibrary("Shell32.dll");
|
||||
if (nsToolkit::mShell32Module) {
|
||||
nsToolkit::mSHGetPathFromIDList = (NS_SHGetPathFromIDList)GetProcAddress(nsToolkit::mShell32Module, "SHGetPathFromIDListW");
|
||||
if (!nsToolkit::mSHGetPathFromIDList)
|
||||
nsToolkit::mSHGetPathFromIDList = &nsSHGetPathFromIDList;
|
||||
nsToolkit::mSHBrowseForFolder = (NS_SHBrowseForFolder)GetProcAddress(module, "SHBrowseForFolderW");
|
||||
nsToolkit::mSHBrowseForFolder = (NS_SHBrowseForFolder)GetProcAddress(nsToolkit::mShell32Module, "SHBrowseForFolderW");
|
||||
if (!nsToolkit::mSHBrowseForFolder)
|
||||
nsToolkit::mSHBrowseForFolder = &nsSHBrowseForFolder;
|
||||
}
|
||||
|
@ -650,8 +664,11 @@ nsToolkit::Startup(HMODULE hModule)
|
|||
void
|
||||
nsToolkit::Shutdown()
|
||||
{
|
||||
if (nsToolkit::mShell32Module)
|
||||
::FreeLibrary(nsToolkit::mShell32Module);
|
||||
|
||||
//VERIFY(::UnregisterClass("nsToolkitClass", nsToolkit::mDllInstance));
|
||||
::UnregisterClass("nsToolkitClass", nsToolkit::mDllInstance);
|
||||
nsToolkit::mUnregisterClass(L"nsToolkitClass", nsToolkit::mDllInstance);
|
||||
}
|
||||
|
||||
nsIEventQueue*
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
|
||||
#ifdef MOZ_UNICODE
|
||||
// Ansi API support
|
||||
static HMODULE mShell32Module;
|
||||
static NS_DefWindowProc mDefWindowProc;
|
||||
static NS_CallWindowProc mCallWindowProc;
|
||||
static NS_SetWindowLong mSetWindowLong;
|
||||
|
@ -127,6 +128,7 @@ public:
|
|||
static NS_GetClassName mGetClassName;
|
||||
static NS_CreateWindowEx mCreateWindowEx;
|
||||
static NS_RegisterClass mRegisterClass;
|
||||
static NS_UnregisterClass mUnregisterClass;
|
||||
static NS_SHGetPathFromIDList mSHGetPathFromIDList;
|
||||
static NS_SHBrowseForFolder mSHBrowseForFolder;
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@ typedef int (WINAPI *NS_GetClassName) (HWND, LPWSTR, int);
|
|||
typedef HWND (WINAPI *NS_CreateWindowEx)
|
||||
(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
|
||||
typedef ATOM (WINAPI *NS_RegisterClass) (CONST WNDCLASSW *);
|
||||
typedef BOOL (WINAPI *NS_UnregisterClass) (LPCWSTR, HINSTANCE);
|
||||
typedef BOOL (WINAPI *NS_SHGetPathFromIDList) (LPCITEMIDLIST, LPWSTR);
|
||||
typedef LPITEMIDLIST (WINAPI *NS_SHBrowseForFolder) (LPBROWSEINFOW);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче