Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value.

Closes #434
This commit is contained in:
William S Fulton 2016-05-14 21:19:14 +01:00
commit 98a31ff633
15 changed files with 180 additions and 14 deletions

View file

@ -0,0 +1,24 @@
<?php
require "tests.php";
require "director_pass_by_value.php";
$passByVal = null;
class director_pass_by_value_Derived extends DirectorPassByValueAbstractBase {
function virtualMethod($b) {
global $passByVal;
$passByVal = $b;
}
}
# bug was the passByVal global object was destroyed after the call to virtualMethod had finished.
$caller = new Caller();
$caller->call_virtualMethod(new director_pass_by_value_Derived());
$ret = $passByVal->getVal();
if ($ret != 0x12345678) {
check::fail("Bad return value, got " . dechex($ret));
}
check::done();
?>