server: Add handle count to object

Vitaliy Margolen wine-patch at kievinfo.com
Mon Nov 14 10:31:59 CST 2005



Vitaliy Margolen

changelog:
  server
  - Add handle count to object
-------------- next part --------------
Index: server/handle.c
===================================================================
RCS file: /home/wine/wine/server/handle.c,v
retrieving revision 1.41
diff -u -p -r1.41 handle.c
--- server/handle.c	29 Oct 2005 12:38:23 -0000	1.41
+++ server/handle.c	14 Nov 2005 16:29:32 -0000
@@ -215,6 +215,8 @@ static obj_handle_t alloc_entry( struct 
     entry->ptr    = grab_object( obj );
     entry->access = access;
     entry->fd     = -1;
+    assert( entry->ptr->handlecount < INT_MAX );
+    entry->ptr->handlecount++;
     return index_to_handle(i);
 }
 
@@ -341,6 +343,8 @@ int close_handle( struct process *proces
         set_error( STATUS_HANDLE_NOT_CLOSABLE );
         return 0;
     }
+    assert( obj->handlecount );
+    obj->handlecount--;
     entry->ptr = NULL;
     if (fd) *fd = entry->fd;
     else if (entry->fd != -1) return 1;  /* silently ignore close attempt if we cannot close the fd */
Index: server/object.h
===================================================================
RCS file: /home/wine/wine/server/object.h,v
retrieving revision 1.68
diff -u -p -r1.68 object.h
--- server/object.h	1 Nov 2005 10:22:38 -0000	1.68
+++ server/object.h	14 Nov 2005 16:29:32 -0000
@@ -73,6 +73,7 @@ struct object_ops
 struct object
 {
     unsigned int              refcount;    /* reference count */
+    unsigned int              handlecount; /* handle count */
     const struct object_ops  *ops;
     struct list               wait_queue;
     struct object_name       *name;


More information about the wine-patches mailing list