Zebediah Figura : server: Call the close_handle callback and release_object_from_handle() in the same loop.

Alexandre Julliard julliard at winehq.org
Mon Jul 5 16:24:20 CDT 2021


Module: wine
Branch: master
Commit: a17469b165d30f14c3340608602085f7603496b9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a17469b165d30f14c3340608602085f7603496b9

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon Jul  5 11:20:00 2021 -0500

server: Call the close_handle callback and release_object_from_handle() in the same loop.

Several server objects check if the last handle is being closed in their
close_handle callback. If a process holds the last two handles to an object,
this code path currently won't be triggered.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/handle.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/server/handle.c b/server/handle.c
index 6efd82f2ff9..15da701ee99 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -174,21 +174,16 @@ static void handle_table_destroy( struct object *obj )
 
     assert( obj->ops == &handle_table_ops );
 
-    /* first notify all objects that handles are being closed */
-    if (table->process)
-    {
-        for (i = 0, entry = table->entries; i <= table->last; i++, entry++)
-        {
-            struct object *obj = entry->ptr;
-            if (obj) obj->ops->close_handle( obj, table->process, index_to_handle(i) );
-        }
-    }
-
     for (i = 0, entry = table->entries; i <= table->last; i++, entry++)
     {
         struct object *obj = entry->ptr;
         entry->ptr = NULL;
-        if (obj) release_object_from_handle( obj );
+        if (obj)
+        {
+            if (table->process)
+                obj->ops->close_handle( obj, table->process, index_to_handle(i) );
+            release_object_from_handle( obj );
+        }
     }
     free( table->entries );
 }




More information about the wine-cvs mailing list