Fix director_basic test case

- This fixes director_basic test case. Uses the new flow in director class methods.
- It also correctly fixes the double free problem in director_detect.
This commit is contained in:
Nihal 2017-09-13 01:05:57 +05:30
commit 7e66388cf3
2 changed files with 12 additions and 3 deletions

View file

@ -411,7 +411,7 @@
SWIGTYPE &,
SWIGTYPE &&
%{
SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
SWIG_SetZval($input, $needNewFlow, $owner, (void *)&$1, $1_descriptor, $zend_obj);
%}
%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
@ -450,7 +450,7 @@
%typemap(directorin) SWIGTYPE
%{
SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2);
SWIG_SetZval($input, $needNewFlow, $owner, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, $zend_obj);
%}
%typemap(out) void "";

View file

@ -3429,6 +3429,15 @@ done:
if ((tm = Getattr(p, "tmap:directorin")) != 0) {
String *parse = Getattr(p, "tmap:directorin:parse");
if (!parse) {
if (is_class(Getattr(p, "type"))) {
String *return_class_name = get_class_name(Getattr(p, "type"));
String *object_name = NewStringEmpty();
Printf(object_name, "%s_object_new(SWIGTYPE_%s_ce)", return_class_name, return_class_name);
Replaceall(tm, "$zend_obj", object_name);
Replaceall(tm, "$needNewFlow", "1");
}
Replaceall(tm, "$zend_obj", "NULL");
Replaceall(tm, "$needNewFlow", "0");
String *input = NewStringf("&args[%d]", idx++);
Setattr(p, "emit:directorinput", input);
Replaceall(tm, "$input", input);
@ -3517,7 +3526,7 @@ done:
char temp[24];
sprintf(temp, "%d", idx);
Replaceall(tm, "$argnum", temp);
Replaceall(tm, "$needNewFlow", "1");
Replaceall(tm, "$needNewFlow", Getattr(n, "feature:new") ? "1" : "0");
/* TODO check this */
if (Getattr(n, "wrap:disown")) {