Avoid potential race conditions on the Dispose() method
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9444 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2780b5ee3b
commit
ea6f44edd2
4 changed files with 35 additions and 19 deletions
|
|
@ -1071,12 +1071,14 @@ public class Base : IDisposable {
|
|||
}
|
||||
|
||||
public virtual void Dispose() {
|
||||
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
examplePINVOKE.delete_Base(swigCPtr);
|
||||
lock(this) {
|
||||
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
examplePINVOKE.delete_Base(swigCPtr);
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public virtual uint UIntMethod(uint x) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue