server: Restart search from the start when releasing permanent objects at exit.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-09-24 14:14:22 +02:00
parent 0a49202109
commit ab9ded062f
1 changed files with 14 additions and 4 deletions

View File

@ -67,11 +67,21 @@ void dump_objects(void)
void close_objects(void)
{
struct object *obj, *obj2;
/* release the permanent objects */
LIST_FOR_EACH_ENTRY_SAFE( obj, obj2, &object_list, struct object, obj_list )
if (obj->is_permanent) release_object( obj );
for (;;)
{
struct object *obj;
int found = 0;
LIST_FOR_EACH_ENTRY( obj, &object_list, struct object, obj_list )
{
if (!(found = obj->is_permanent)) continue;
obj->is_permanent = 0;
release_object( obj );
break;
}
if (!found) break;
}
dump_objects(); /* dump any remaining objects */
}