You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -146,19 +146,15 @@ namespace System.Runtime.InteropServices
|
||||
{
|
||||
if (!_fullyInitialized)
|
||||
throw new InvalidOperationException ();
|
||||
DisposeInternal ();
|
||||
|
||||
DangerousReleaseInternal (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
void InternalFinalize ()
|
||||
{
|
||||
if (_fullyInitialized)
|
||||
DisposeInternal ();
|
||||
}
|
||||
|
||||
void DisposeInternal ()
|
||||
{
|
||||
DangerousReleaseInternal (true);
|
||||
GC.SuppressFinalize (this);
|
||||
DangerousReleaseInternal (true);
|
||||
}
|
||||
|
||||
void DangerousReleaseInternal (bool dispose)
|
||||
@@ -192,23 +188,27 @@ namespace System.Runtime.InteropServices
|
||||
if ((old_state & RefCount_Mask) == 0)
|
||||
throw new ObjectDisposedException ("handle");
|
||||
|
||||
perform_release =
|
||||
(old_state & RefCount_Mask) == RefCount_One
|
||||
&& (old_state & (int) State.Closed) == 0
|
||||
&& _ownsHandle;
|
||||
|
||||
if (perform_release && IsInvalid)
|
||||
if ((old_state & RefCount_Mask) != RefCount_One)
|
||||
perform_release = false;
|
||||
else if ((old_state & (int) State.Closed) != 0)
|
||||
perform_release = false;
|
||||
else if (!_ownsHandle)
|
||||
perform_release = false;
|
||||
else if (IsInvalid)
|
||||
perform_release = false;
|
||||
else
|
||||
perform_release = true;
|
||||
|
||||
/* Attempt the update to the new state, fail and retry if the initial
|
||||
* state has been modified in the meantime. Decrement the ref count by
|
||||
* substracting SH_RefCountOne from the state then OR in the bits for
|
||||
* Dispose (if that's the reason for the Release) and closed (if the
|
||||
* initial ref count was 1). */
|
||||
new_state =
|
||||
(old_state - RefCount_One)
|
||||
| ((old_state & RefCount_Mask) == RefCount_One ? (int) State.Closed : 0)
|
||||
| (dispose ? (int) State.Disposed : 0);
|
||||
new_state = (old_state & RefCount_Mask) - RefCount_One;
|
||||
if ((old_state & RefCount_Mask) == RefCount_One)
|
||||
new_state |= (int) State.Closed;
|
||||
if (dispose)
|
||||
new_state |= (int) State.Disposed;
|
||||
} while (Interlocked.CompareExchange (ref _state, new_state, old_state) != old_state);
|
||||
|
||||
if (perform_release)
|
||||
|
||||
Reference in New Issue
Block a user