[PATCH 1/4] server: Move completion from async object to async queue.

Erich E. Hoover ehoover at mymail.mines.edu
Mon Jun 4 14:28:47 CDT 2012

On Mon, Jun 4, 2012 at 2:53 AM, Alexandre Julliard <julliard at winehq.org> wrote:
> ...
> I don't think that you can have an async queue that outlives its file
> descriptor.

Well, maybe I screwed something up - but when I tried to access the
descriptor like that it caused segfaults in some of the tests.  What I
found was that neither create_async_queue or create_async increment
the refcount on the file descriptor, but create_async does increment
the refcount on the async queue so that the async queue will live
throughout the life of the async.  So, what appeared to happen is
1) A file descriptor is created.
2) An async operation is queued on the file descriptor.
3) The file descriptor is closed (queuing the async to wake up and
contact user space).
4) The file descriptor is destroyed because its refcount reaches zero.
5) The async operation returns from user space with completion
information for the operation.
6) Accessing the completion from the no-longer existing file
descriptor causes a crash.

I tried having the async and/or the async queue increment the refcount
for the file descriptor, but that caused a host of other problems
(mainly file descriptors never closing).  So, I'm pretty sure that the
completion information needs to be held separately in the async queue
- but I can go back and double check that this is the case if you'd

Erich Hoover
ehoover at mines.edu

More information about the wine-devel mailing list