gdiplus: Replace GpImage's busy flag with SRWLOCK.
commit72c0c88f2a5c9b52bb01f7981c0894a47efa55f3
authorJinoh Kang <jinoh.kang.kr@gmail.com>
Sat, 22 Oct 2022 12:25:37 +0000 (22 21:25 +0900)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 24 Oct 2022 09:17:39 +0000 (24 11:17 +0200)
tree443abe0762b4f7325c31468f4d5b5465a93a917c
parent7abca9742a9410447636e0222e36d214449c90dd
gdiplus: Replace GpImage's busy flag with SRWLOCK.

Today, the image_unlock() helper function has a data race due to
non-atomic write to GpImage's 'busy' flag which is accessible by other
threads.  Also, it lacks a release fence, which means that other threads
can observe the unlocked (busy = 0) state too early when the current
thread unlocks the image; specifically, the write to the 'busy' field of
the GpImage can be reordered before the last read/write to any other
fields of the same GpImage.

Fix this by replacing the 'busy' field of GpImage with SRWLOCK.
dlls/gdiplus/gdiplus_private.h
dlls/gdiplus/image.c