wez             Mon Apr 18 12:38:31 2005 EDT

  Modified files:              
    /php-src/ext/com_dotnet     com_handlers.c 
  Log:
  merge bug fixes from branch
  
http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_handlers.c?r1=1.27&r2=1.28&ty=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.27 
php-src/ext/com_dotnet/com_handlers.c:1.28
--- php-src/ext/com_dotnet/com_handlers.c:1.27  Sat Nov 20 06:40:49 2004
+++ php-src/ext/com_dotnet/com_handlers.c       Mon Apr 18 12:38:31 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_handlers.c,v 1.27 2004/11/20 11:40:49 rrichards Exp $ */
+/* $Id: com_handlers.c,v 1.28 2005/04/18 16:38:31 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -525,14 +525,15 @@
        php_com_dotnet_object *obj;
        VARIANT v;
        VARTYPE vt = VT_EMPTY;
+       zval free_obj;
+       HRESULT res = S_OK;
        
        if (should_free) {
-               zval_dtor(writeobj);
+               free_obj = *writeobj;
        }
 
-       ZVAL_NULL(writeobj);
-
        obj = CDNO_FETCH(readobj);
+       ZVAL_NULL(writeobj);
        VariantInit(&v);
 
        if (V_VT(&obj->v) == VT_DISPATCH) {
@@ -566,12 +567,24 @@
        }
 
        if (vt != VT_EMPTY && vt != V_VT(&v)) {
-               VariantChangeType(&v, &v, 0, vt);
+               res = VariantChangeType(&v, &v, 0, vt);
+       }
+
+       if (SUCCEEDED(res)) {
+               php_com_zval_from_variant(writeobj, &v, obj->code_page 
TSRMLS_CC);
        }
 
-       php_com_zval_from_variant(writeobj, &v, obj->code_page TSRMLS_CC);
        VariantClear(&v);
-       return SUCCESS;
+
+       if (should_free) {
+               zval_dtor(&free_obj);
+       }
+
+       if (SUCCEEDED(res)) {
+               return SUCCESS;
+       }
+
+       return FAILURE;
 }
 
 static int com_object_count(zval *object, long *count TSRMLS_DC)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to