cvs: ZendEngine2(PHP_5_3) / zend_objects_API.c
| From: | Dmitry Stogov | Date: | Tue, 19 Feb 2008 17:05:41 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_3) / zend_objects_API.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6435@lists.php.net to get a copy of this message | ||
dmitry Tue Feb 19 17:05:41 2008 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_objects_API.c
Log:
everted (this part was committed by mistake)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_objects_API.c?r1=1.47.2.6.2.6.2.4&r2=1.47.2.6.2.6.2.5&diff_format=u
Index: ZendEngine2/zend_objects_API.c
diff -u ZendEngine2/zend_objects_API.c:1.47.2.6.2.6.2.4
ZendEngine2/zend_objects_API.c:1.47.2.6.2.6.2.5
--- ZendEngine2/zend_objects_API.c:1.47.2.6.2.6.2.4 Tue Feb 19 12:00:53 2008
+++ ZendEngine2/zend_objects_API.c Tue Feb 19 17:05:41 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_objects_API.c,v 1.47.2.6.2.6.2.4 2008/02/19 12:00:53 dmitry Exp $ */
+/* $Id: zend_objects_API.c,v 1.47.2.6.2.6.2.5 2008/02/19 17:05:41 dmitry Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -158,7 +158,8 @@
#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \
EG(objects_store).object_buckets[handle].bucket.free_list.next =
EG(objects_store).free_list_head; \
- EG(objects_store).free_list_head = handle;
+ EG(objects_store).free_list_head = handle; \
+ EG(objects_store).object_buckets[handle].valid = 0;
ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
{
@@ -185,12 +186,13 @@
return;
}
+ obj = &EG(objects_store).object_buckets[handle].bucket.obj;
+
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
when the refcount reaches 0 a second time
*/
if (EG(objects_store).object_buckets[handle].valid) {
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
if (obj->refcount == 1) {
if (!EG(objects_store).object_buckets[handle].destructor_called) {
EG(objects_store).object_buckets[handle].destructor_called = 1;
@@ -204,7 +206,6 @@
}
}
if (obj->refcount == 1) {
- EG(objects_store).object_buckets[handle].valid = 0;
GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
if (obj->free_storage) {
zend_try {
@@ -216,20 +217,19 @@
ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST();
}
}
+ }
- obj->refcount--;
+ obj->refcount--;
#if ZEND_DEBUG_OBJECTS
- if (obj->refcount == 0) {
- fprintf(stderr, "Deallocated object id #%d\n", handle);
- } else {
- fprintf(stderr, "Decreased refcount of object id #%d\n", handle);
- }
+ if (obj->refcount == 0) {
+ fprintf(stderr, "Deallocated object id #%d\n", handle);
+ } else {
+ fprintf(stderr, "Decreased refcount of object id #%d\n", handle);
+ }
#endif
-
- if (failure) {
- zend_bailout();
- }
+ if (failure) {
+ zend_bailout();
}
}