[PATCH] Remove potential reference count races.
Nikolay Sivov
bunglehead at gmail.com
Sun Oct 28 01:30:31 CDT 2012
On 10/28/2012 04:59, max at mtew.isa-geek.net wrote:
> From: Max TenEyck Woodbury <max at mtew.isa-geek.net>
>
> ---
> dlls/gdi32/freetype.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
> index 6af977c..3379c6e 100644
> --- a/dlls/gdi32/freetype.c
> +++ b/dlls/gdi32/freetype.c
> @@ -3820,7 +3820,7 @@ static struct font_mapping *map_font_file( const char *name )
> {
> if (mapping->dev == st.st_dev && mapping->ino == st.st_ino)
> {
> - mapping->refcount++;
> + InterlockedIncrement(&mapping->refcount);
> close( fd );
> return mapping;
> }
> @@ -3850,7 +3850,7 @@ error:
>
> static void unmap_font_file( struct font_mapping *mapping )
> {
> - if (!--mapping->refcount)
> + if (!InterlockedDecrement(&mapping->refcount))
> {
> list_remove( &mapping->entry );
> munmap( mapping->data, mapping->size );
How does it help exactly and what is the problem with this code?
More information about the wine-devel
mailing list