mscms: Handle errors from lcms more gracefully.
Default behavior of lcms is to abort the process when it encounters an error it considers fatal, such as a corrupt color profile.
This commit is contained in:
parent
a7b70911b3
commit
12dac70a32
|
@ -36,6 +36,23 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
|
||||
|
||||
#ifdef HAVE_LCMS
|
||||
static int lcms_error_handler( int error, const char *text )
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case LCMS_ERRC_WARNING:
|
||||
case LCMS_ERRC_RECOVERABLE:
|
||||
case LCMS_ERRC_ABORTED:
|
||||
WARN("%d %s\n", error, debugstr_a(text));
|
||||
return 1;
|
||||
default:
|
||||
ERR("unknown error %d %s\n", error, debugstr_a(text));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||
{
|
||||
TRACE( "(%p, %d, %p)\n", hinst, reason, reserved );
|
||||
|
@ -44,6 +61,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
|||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls( hinst );
|
||||
#ifdef HAVE_LCMS
|
||||
cmsSetErrorHandler( lcms_error_handler );
|
||||
#endif
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
#ifdef HAVE_LCMS
|
||||
|
|
Loading…
Reference in New Issue