Bug 632969 - 1/4 - X error handling fixes - r=bjacob, a=blocker

This commit is contained in:
Karl Tomlinson 2011-02-11 18:11:30 -05:00
parent cbdf33fdbe
commit e9884a8b98
2 changed files with 8 additions and 4 deletions

View File

@ -46,11 +46,13 @@ ScopedXErrorHandler::ErrorEvent* ScopedXErrorHandler::sXErrorPtr;
int
ScopedXErrorHandler::ErrorHandler(Display *, XErrorEvent *ev)
{
sXErrorPtr->mError = *ev;
// only record the error if no error was previously recorded.
// this means that in case of multiple errors, it's the first error that we report.
if (!sXErrorPtr->mError.error_code)
sXErrorPtr->mError = *ev;
return 0;
}
ScopedXErrorHandler::ScopedXErrorHandler()
{
// let sXErrorPtr point to this object's mXError object, but don't reset this mXError object!

View File

@ -158,9 +158,11 @@ public:
~ScopedXErrorHandler();
/** \returns true if a X error occurred since the last time this method was called on this ScopedXErrorHandler object.
/** \returns true if a X error occurred since the last time this method was called on this ScopedXErrorHandler object,
* or since the creation of this ScopedXErrorHandler object if this method was never called on it.
*
* \param ev this optional parameter, if set, will be filled with the XErrorEvent object
* \param ev this optional parameter, if set, will be filled with the XErrorEvent object. If multiple errors occurred,
* the first one will be returned.
*/
bool SyncAndGetError(Display *dpy, XErrorEvent *ev = nsnull);
};