localspl: Unload monitor in DeleteMonitor.
Some print monitors are very sensitive to loads/unloads being done in a quick succession like AddMonitor() does, and that even leads to crashes because the monitor I have here creates a thread on load and when the thread starts - the monitor dll is already unloaded. A solution to this is moving the monitor unloading to DeleteMonitor. Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d9518240c3
commit
db4d01e191
|
@ -1560,10 +1560,7 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
|
|||
res = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor_unload(pm);
|
||||
SetLastError(ERROR_SUCCESS); /* Monitor installer depends on this */
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(hentry);
|
||||
|
@ -1857,6 +1854,7 @@ static BOOL WINAPI fpConfigurePort(LPWSTR pName, HWND hWnd, LPWSTR pPortName)
|
|||
|
||||
static BOOL WINAPI fpDeleteMonitor(LPWSTR pName, LPWSTR pEnvironment, LPWSTR pMonitorName)
|
||||
{
|
||||
monitor_t *pm;
|
||||
HKEY hroot = NULL;
|
||||
LONG lres;
|
||||
|
||||
|
@ -1877,6 +1875,18 @@ static BOOL WINAPI fpDeleteMonitor(LPWSTR pName, LPWSTR pEnvironment, LPWSTR pMo
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Unload the monitor if it's loaded */
|
||||
EnterCriticalSection(&monitor_handles_cs);
|
||||
LIST_FOR_EACH_ENTRY(pm, &monitor_handles, monitor_t, entry)
|
||||
{
|
||||
if (pm->name && !lstrcmpW(pMonitorName, pm->name))
|
||||
{
|
||||
monitor_unload(pm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&monitor_handles_cs);
|
||||
|
||||
if(RegCreateKeyW(HKEY_LOCAL_MACHINE, monitorsW, &hroot) != ERROR_SUCCESS) {
|
||||
ERR("unable to create key %s\n", debugstr_w(monitorsW));
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue