Re: Repost : Recursive Calls on EG(regular_list)
| From: | Andi Gutmans | Date: | Thu, 17 May 2001 17:37:14 +0000 |
| Subject: | Re: Repost : Recursive Calls on EG(regular_list) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-55656@lists.php.net to get a copy of this message | ||
Clayton,
This used to not work a few months ago but we made a general fix in the hash tables which should allow your code to run fine.
In case you encounter any problems let us know.
Andi
At 01:36 PM 5/17/2001 -0400, clayton collie wrote:
the list has been busy as of late, so i suppose this got lost in the shuffle. anyways, here goes again : im creating an extension which exposes classes which may act as containers to other classes. These contained classes also get exposed via the extension. Now when the container class gets destructed by the user $container->close(), called before RSHUTDOWN ), i need to ensure that all resources allocated by the contained objects are released, otherwise nastiness can occur is the user tries to access the contained objects later in the script. to that end, ive written something like the following. i just wanted to know if it will cause any problems, since it accesses EG(regular_list) from a resource destructor. BTW the list destructor is destroy_container_resource . static int _kill_contained_objects(zend_rsrc_list *le,void *argument) {container_t *cont = (container_t *)argument; if (le->type == le_contained_object) { contained_t *field = (contained_t *)le->ptr; return (field->container == cont); } return 0;} static void kill_kids(apply_func_arg_t func, void *parent) {EGLS_FETCH(); zend_hash_apply_with_argument( &EG(regular_list), func, parent );} static void destroy_container_resource(zend_rsrc_list_entry *rsrc) {container_t *cont = (container_t *)rsrc->ptr; kill_kids( (apply_func_t) _kill_contained_objects, cont ); container_free(cont);} -- _____________________________________ "Fried Ice-Cream is a reality !" - George Clinton -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net