Commit 0e4f742f authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Don't bother freeing graphics drivers.

parent 1af17844
......@@ -674,7 +674,6 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
error:
if (dc) free_dc_ptr( dc );
DRIVER_release_driver( funcs );
return 0;
}
......@@ -759,7 +758,6 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
physDev = origDC->physDev;
}
release_dc_ptr( origDC );
if (funcs) funcs = DRIVER_get_driver( funcs );
}
if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0;
......@@ -790,7 +788,6 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
error:
if (dc) free_dc_ptr( dc );
DRIVER_release_driver( funcs );
return 0;
}
......@@ -800,7 +797,6 @@ error:
*/
BOOL WINAPI DeleteDC( HDC hdc )
{
const DC_FUNCTIONS *funcs = NULL;
DC * dc;
TRACE("%p\n", hdc );
......@@ -838,13 +834,11 @@ BOOL WINAPI DeleteDC( HDC hdc )
SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
funcs = dc->funcs;
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
dc->physDev = NULL;
}
free_dc_ptr( dc );
if (funcs) DRIVER_release_driver( funcs ); /* do that after releasing the GDI lock */
return TRUE;
}
......
......@@ -42,7 +42,6 @@ struct graphics_driver
{
struct list entry;
HMODULE module; /* module handle */
unsigned int count; /* reference count */
DC_FUNCTIONS funcs;
};
......@@ -69,7 +68,6 @@ static struct graphics_driver *create_driver( HMODULE module )
if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL;
driver->module = module;
driver->count = 1;
/* fill the function table */
if (module)
......@@ -227,11 +225,7 @@ static struct graphics_driver *load_display_driver(void)
HMODULE module = 0;
HKEY hkey;
if (display_driver) /* already loaded */
{
display_driver->count++;
return display_driver;
}
if (display_driver) return display_driver; /* already loaded */
strcpy( buffer, "x11" ); /* default value */
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
......@@ -260,7 +254,6 @@ static struct graphics_driver *load_display_driver(void)
ExitProcess(1);
}
display_driver->count++; /* we don't want to free it */
return display_driver;
}
......@@ -292,7 +285,6 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
{
if (driver->module == module)
{
driver->count++;
LeaveCriticalSection( &driver_section );
return &driver->funcs;
}
......@@ -318,50 +310,6 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
}
/**********************************************************************
* DRIVER_get_driver
*
* Get a new copy of an existing driver.
*/
const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
{
struct graphics_driver *driver;
EnterCriticalSection( &driver_section );
LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
if (&driver->funcs == funcs) break;
if (&driver->entry == &drivers) ERR( "driver not found, trouble ahead\n" );
driver->count++;
LeaveCriticalSection( &driver_section );
return funcs;
}
/**********************************************************************
* DRIVER_release_driver
*
* Release a driver by decrementing ref count and freeing it if needed.
*/
void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
{
struct graphics_driver *driver;
EnterCriticalSection( &driver_section );
LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
{
if (&driver->funcs != funcs) continue;
if (--driver->count) break;
list_remove( &driver->entry );
if (driver == display_driver) display_driver = NULL;
FreeLibrary( driver->module );
HeapFree( GetProcessHeap(), 0, driver );
break;
}
LeaveCriticalSection( &driver_section );
}
/*****************************************************************************
* DRIVER_GetDriverName
*
......
......@@ -386,8 +386,6 @@ extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
/* driver.c */
extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs ) DECLSPEC_HIDDEN;
extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs ) DECLSPEC_HIDDEN;
extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN;
/* enhmetafile.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment