diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 44d5798100..78ff1a7d76 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -179,6 +179,14 @@ static inline PHYSDEV pop_dc_driver( DC *dc, PHYSDEV dev ) return dev; } +static inline PHYSDEV find_dc_driver( DC *dc, const struct gdi_dc_funcs *funcs ) +{ + PHYSDEV dev; + + for (dev = dc->physDev; dev; dev = dev->next) if (dev->funcs == funcs) return dev; + return NULL; +} + /* bitmap object */ typedef struct tagBITMAPOBJ diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 0a591af15f..a58f4e677b 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -856,14 +856,15 @@ static BOOL pathdrv_DeleteDC( PHYSDEV dev ) BOOL PATH_SavePath( DC *dst, DC *src ) { - struct path_physdev *physdev; + PHYSDEV dev; if (src->path) { if (!(dst->path = copy_gdi_path( src->path ))) return FALSE; } - else if ((physdev = find_path_physdev( src ))) + else if ((dev = find_dc_driver( src, &path_driver ))) { + struct path_physdev *physdev = get_path_physdev( dev ); if (!(dst->path = copy_gdi_path( physdev->path ))) return FALSE; dst->path_open = TRUE; } @@ -880,7 +881,7 @@ BOOL PATH_RestorePath( DC *dst, DC *src ) if (!physdev) { if (!path_driver.pCreateDC( &dst->physDev, NULL, NULL, NULL, NULL )) return FALSE; - physdev = get_path_physdev( dst->physDev ); + physdev = get_path_physdev( find_dc_driver( dst, &path_driver )); } else free_gdi_path( physdev->path ); @@ -2101,7 +2102,7 @@ BOOL nulldrv_BeginPath( PHYSDEV dev ) free_gdi_path( path ); return FALSE; } - physdev = get_path_physdev( dc->physDev ); + physdev = get_path_physdev( find_dc_driver( dc, &path_driver )); physdev->path = path; if (dc->path) free_gdi_path( dc->path ); dc->path = NULL;