[v5 PATCH 1/3] dwrite: Protect cached fontface list when accessed from multiple threads

Anton Romanov theli.ua at gmail.com
Thu Aug 17 00:05:44 CDT 2017


On Tue, Aug 15, 2017 at 4:40 AM, Nikolay Sivov <nsivov at codeweavers.com> wrote:
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
>  dlls/dwrite/dwrite_private.h | 15 ++++++++---
>  dlls/dwrite/font.c           | 30 +++++++++++++--------
>  dlls/dwrite/main.c           | 63 +++++++++++++++++++++++++++++++-------------
>  3 files changed, 74 insertions(+), 34 deletions(-)
>
Since apps seem to freely use fontface interfaces from multiple
threads - Isn't the following race possible?

+----------------+------------------------+-------------------------+
|       T1       |           T2           |           T3            |
+----------------+------------------------+-------------------------+
| Release        |                        |                         |
| Decrement      |                        |                         |
| == 0 -> True   |                        |                         |
|                | Query_Interface/AddRef |                         |
|                | Increment              |                         |
|                |                        | Release                 |
|                |                        | Decrement               |
| free(cached)   |                        |                         |
| factory_unlock |                        |                         |
|                |                        | use after free (cached) |
+----------------+------------------------+-------------------------+



More information about the wine-devel mailing list