libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use GetErrorMode if it is available (on Windows Vista and above).


From: Peter Rosin
Subject: Re: Use GetErrorMode if it is available (on Windows Vista and above).
Date: Tue, 12 Jan 2010 11:00:17 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Den 2010-01-04 20:46 skrev Ralf Wildenhues:
Hi Peter,

* Peter Rosin wrote on Sat, Jan 02, 2010 at 12:29:11PM CET:
Here's another patch, it makes use of the new function GetErrorMode,
if available, instead of cludging it by calling SetErrorMode twice.
GetErrorMode was introduced with Windows Vista.

This patch does not apply cleanly to a clean git repo, it changes
lines too close to the previous error reporting patch(es), but it
is orthogonal.
Oops, forgot the patch...
Oops, old version of the patch (GetProcAddressA doesn't exist, this
version uses GetProcessAddress). Sorry for the inconvenience.

I can't judge w32 code at all, so I believe you when you say the old
version was a kludge.  In what way, though?  Did it provide less
functionality, were we using something "deprecated" by the vendor, or
are we just pleasing aesthetics here?

Without the patch, a separate thread of the process could be relying on
the error mode to have some specific flag. Then, during a small window
the loadlibrary loader clears some vital error mode flag since it has
to set a temporary error mode (which might be insufficient for that other
thread) to retrieve the existing error mode. There is a possibility that
things go downhill due to that race. With the patch (and GetErrorMode
support) the loader can fail critical errors (i.e. no irritating popup
dialog) without clobbering other error mode flags in the process.

That said, a potential race is still there since the error mode is
process global and we are trying to save the current error mode and
restore it afterwards, some other thread might do the same and we'd get
into an inconsistent state if unlucky. There's no way to deal with that
though, short of adding some locking mechanism and requiring client code
to follow our lead.

Have you tested it on some system that has GetErrorMode (Vista) and some
that doesn't (something older)?

I have tested on Wine (w/ GetErrorMode) and XP (w/o). It behaves as
designed on both AFAICT, and I get the same number of irritating popups
with and without the patch when I run the testsuite.

Cheers,
Peter

--
They are in the crowd with the answer before the question.
> Why do you dislike Jeopardy?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]