mirror of
https://github.com/reactos/reactos.git
synced 2024-09-01 16:18:46 +00:00
Delete all GLDCDATA structures in wglDeleteContext that share the same ICD
svn path=/trunk/; revision=30450
This commit is contained in:
parent
349ba2667d
commit
0e033bbd53
|
@ -521,11 +521,8 @@ OPENGL32_UnloadICD( GLDRIVERDATA *icd )
|
||||||
return FALSE; /* FIXME: do we have to expect such an error and handle it? */
|
return FALSE; /* FIXME: do we have to expect such an error and handle it? */
|
||||||
}
|
}
|
||||||
|
|
||||||
icd->refcount--;
|
if (--icd->refcount == 0)
|
||||||
if (icd->refcount == 0)
|
|
||||||
// if (0)
|
|
||||||
ret = OPENGL32_UnloadDriver( icd );
|
ret = OPENGL32_UnloadDriver( icd );
|
||||||
/* FIXME: InitializeICD crashes when called a second time */
|
|
||||||
|
|
||||||
/* release mutex */
|
/* release mutex */
|
||||||
if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
|
if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
|
||||||
|
|
|
@ -122,7 +122,7 @@ ROSGL_RemoveContext( GLRC *glrc )
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
GLRC *
|
GLRC *
|
||||||
ROSGL_NewContext()
|
ROSGL_NewContext(void)
|
||||||
{
|
{
|
||||||
GLRC *glrc;
|
GLRC *glrc;
|
||||||
|
|
||||||
|
@ -136,6 +136,51 @@ ROSGL_NewContext()
|
||||||
return glrc;
|
return glrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief Delete all GLDCDATA with this IDC
|
||||||
|
*
|
||||||
|
* \param icd [IN] Pointer to a ICD
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
ROSGL_DeleteDCDataForICD( GLDRIVERDATA *icd )
|
||||||
|
{
|
||||||
|
GLDCDATA *p, **pptr;
|
||||||
|
|
||||||
|
/* synchronize */
|
||||||
|
if (WaitForSingleObject( OPENGL32_processdata.dcdata_mutex, INFINITE ) ==
|
||||||
|
WAIT_FAILED)
|
||||||
|
{
|
||||||
|
DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = OPENGL32_processdata.dcdata_list;
|
||||||
|
pptr = &OPENGL32_processdata.dcdata_list;
|
||||||
|
while (p != NULL)
|
||||||
|
{
|
||||||
|
if (p->icd == icd)
|
||||||
|
{
|
||||||
|
*pptr = p->next;
|
||||||
|
OPENGL32_UnloadICD( p->icd );
|
||||||
|
|
||||||
|
if (!HeapFree( GetProcessHeap(), 0, p ))
|
||||||
|
DBGPRINT( "Warning: HeapFree() on GLDCDATA failed (%d)",
|
||||||
|
GetLastError() );
|
||||||
|
|
||||||
|
p = *pptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pptr = &p->next;
|
||||||
|
p = p->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* release mutex */
|
||||||
|
if (!ReleaseMutex( OPENGL32_processdata.dcdata_mutex ))
|
||||||
|
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Delete a GL Context (GLRC) and remove it from the list
|
/*! \brief Delete a GL Context (GLRC) and remove it from the list
|
||||||
*
|
*
|
||||||
|
@ -150,7 +195,7 @@ ROSGL_DeleteContext( GLRC *glrc )
|
||||||
{
|
{
|
||||||
/* unload icd */
|
/* unload icd */
|
||||||
if (glrc->icd != NULL)
|
if (glrc->icd != NULL)
|
||||||
OPENGL32_UnloadICD( glrc->icd );
|
ROSGL_DeleteDCDataForICD( glrc->icd );
|
||||||
|
|
||||||
/* remove from list */
|
/* remove from list */
|
||||||
ROSGL_RemoveContext( glrc );
|
ROSGL_RemoveContext( glrc );
|
||||||
|
|
Loading…
Reference in a new issue