Fix undefined behaviour when throwing exceptions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7053 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c9df29c482
commit
ee16fd54e0
2 changed files with 8 additions and 9 deletions
|
|
@ -54,12 +54,12 @@ public class runme
|
||||||
try {
|
try {
|
||||||
csharp_exceptions.NullReference(null);
|
csharp_exceptions.NullReference(null);
|
||||||
throw new Exception("NullReference not working");
|
throw new Exception("NullReference not working");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
csharp_exceptions.NullValue(null);
|
csharp_exceptions.NullValue(null);
|
||||||
throw new Exception("NullValue not working");
|
throw new Exception("NullValue not working");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// enums
|
// enums
|
||||||
|
|
@ -80,12 +80,12 @@ public class runme
|
||||||
try {
|
try {
|
||||||
csharp_exceptions.NullStdStringValue(null);
|
csharp_exceptions.NullStdStringValue(null);
|
||||||
throw new Exception("NullStdStringValue not working");
|
throw new Exception("NullStdStringValue not working");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
csharp_exceptions.NullStdStringReference(null);
|
csharp_exceptions.NullStdStringReference(null);
|
||||||
throw new Exception("NullStdStringReference not working");
|
throw new Exception("NullStdStringReference not working");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
csharp_exceptions.ExceptionSpecificationStdStringValue();
|
csharp_exceptions.ExceptionSpecificationStdStringValue();
|
||||||
|
|
@ -114,7 +114,7 @@ public class runme
|
||||||
try {
|
try {
|
||||||
new constructor(null);
|
new constructor(null);
|
||||||
throw new Exception("constructor 1 not working");
|
throw new Exception("constructor 1 not working");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
new constructor();
|
new constructor();
|
||||||
|
|
@ -278,7 +278,6 @@ public class runme
|
||||||
Thread[] threads = new Thread[NUM_THREADS];
|
Thread[] threads = new Thread[NUM_THREADS];
|
||||||
TestThread[] testThreads = new TestThread[NUM_THREADS];
|
TestThread[] testThreads = new TestThread[NUM_THREADS];
|
||||||
// invoke the threads
|
// invoke the threads
|
||||||
Console.WriteLine("Thread tests");
|
|
||||||
for (int i=0; i<NUM_THREADS; i++) {
|
for (int i=0; i<NUM_THREADS; i++) {
|
||||||
testThreads[i] = new TestThread(throwsClass, i);
|
testThreads[i] = new TestThread(throwsClass, i);
|
||||||
threads[i] = new Thread(new ThreadStart(testThreads[i].Run));
|
threads[i] = new Thread(new ThreadStart(testThreads[i].Run));
|
||||||
|
|
@ -307,7 +306,7 @@ public class TestThread {
|
||||||
public void Run() {
|
public void Run() {
|
||||||
Failed = false;
|
Failed = false;
|
||||||
try {
|
try {
|
||||||
for (int i=0; i<80000; i++) { // run test for about 30 seconds on a 1GHz machine
|
for (int i=0; i<6000; i++) { // run test for about 10 seconds on a 1GHz machine (Mono)
|
||||||
try {
|
try {
|
||||||
throwsClass.ThrowException(i);
|
throwsClass.ThrowException(i);
|
||||||
throw new Exception("No exception thrown");
|
throw new Exception("No exception thrown");
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public class runme
|
||||||
try {
|
try {
|
||||||
li_std_string.test_value(null);
|
li_std_string.test_value(null);
|
||||||
throw new Exception("Test 2 failed");
|
throw new Exception("Test 2 failed");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking expected use of %typemap(in) const std::string & {}
|
// Checking expected use of %typemap(in) const std::string & {}
|
||||||
|
|
@ -30,7 +30,7 @@ public class runme
|
||||||
try {
|
try {
|
||||||
li_std_string.test_const_reference(null);
|
li_std_string.test_const_reference(null);
|
||||||
throw new Exception("Test 4 failed");
|
throw new Exception("Test 4 failed");
|
||||||
} catch (NullReferenceException) {
|
} catch (ArgumentNullException) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue