mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1240985 - Fix bug where mAwaitingSyncReply can be overwritten in Send after Cancel (r=dvander)
This commit is contained in:
parent
2de94a9236
commit
cea71a6b75
@ -525,16 +525,22 @@ class MessageChannel : HasResultCodes
|
||||
class AutoSetValue {
|
||||
public:
|
||||
explicit AutoSetValue(T &var, const T &newValue)
|
||||
: mVar(var), mPrev(var)
|
||||
: mVar(var), mPrev(var), mNew(newValue)
|
||||
{
|
||||
mVar = newValue;
|
||||
}
|
||||
~AutoSetValue() {
|
||||
mVar = mPrev;
|
||||
// The value may have been zeroed if the transaction was
|
||||
// canceled. In that case we shouldn't return it to its previous
|
||||
// value.
|
||||
if (mVar == mNew) {
|
||||
mVar = mPrev;
|
||||
}
|
||||
}
|
||||
private:
|
||||
T& mVar;
|
||||
T mPrev;
|
||||
T mNew;
|
||||
};
|
||||
|
||||
// Worker thread only.
|
||||
|
Loading…
Reference in New Issue
Block a user