Avoid adding a ref in OpenProcess (), it is already added in _wapi_search_handle...
authorZoltan Varga <vargaz@gmail.com>
Fri, 4 Nov 2011 17:15:10 +0000 (18:15 +0100)
committerZoltan Varga <vargaz@gmail.com>
Fri, 4 Nov 2011 17:15:10 +0000 (18:15 +0100)
mono/io-layer/handles.c
mono/io-layer/processes.c

index 2aade80c9fc9e8b0521dc076a2c03fe61cf10249..7eaf93ae082286d096082f1dd67426ed1158d5b3 100644 (file)
@@ -816,6 +816,7 @@ _wapi_handle_foreach (WapiHandleType type,
  * unreffed if the check function returns FALSE, so callers must not
  * rely on the handle persisting (unless the check function returns
  * TRUE)
+ * The caller owns the returned handle.
  */
 gpointer _wapi_search_handle (WapiHandleType type,
                              gboolean (*check)(gpointer test, gpointer user),
index 06a9a06d579853556dd03db6dba1f0c2aa871a3d..2404b3cfd2e9ff2386e5904269809e2794db8144 100644 (file)
@@ -1529,6 +1529,9 @@ gboolean CloseProcess(gpointer handle)
        return CloseHandle (handle);
 }
 
+/*
+ * The caller owns the returned handle and must call CloseProcess () on it to clean it up.
+ */
 gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, guint32 pid)
 {
        /* Find the process handle that corresponds to pid */
@@ -1560,8 +1563,7 @@ gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_
                }
        }
 
-       _wapi_handle_ref (handle);
-       
+       /* _wapi_search_handle () already added a ref */
        return(handle);
 }