[OPENGL32] Misc refactoring and a bugfix for Nvidia OpenGL ICD (#8656)

* [OPENGL32] Use NDK definitions for list functions
* [OPENGL32] wglCreateLayerContext: Insert an entry into context list

Fixes a crash when wglDeleteContext is called on layer context.
This commit is contained in:
Adam Słaboń
2026-02-07 00:36:47 +00:00
committed by GitHub
parent f9c7221a1e
commit 50d99bf974
2 changed files with 7 additions and 43 deletions
+3 -41
View File
@@ -21,51 +21,13 @@
#include <pstypes.h>
#endif
#define NTOS_MODE_USER
#include <rtlfuncs.h>
#include <wine/debug.h>
#include "icd.h"
/* *$%$£^§! headers inclusion */
static __inline
BOOLEAN
RemoveEntryList(
_In_ PLIST_ENTRY Entry)
{
PLIST_ENTRY OldFlink;
PLIST_ENTRY OldBlink;
OldFlink = Entry->Flink;
OldBlink = Entry->Blink;
OldFlink->Blink = OldBlink;
OldBlink->Flink = OldFlink;
return (OldFlink == OldBlink);
}
static __inline
VOID
InsertTailList(
_In_ PLIST_ENTRY ListHead,
_In_ PLIST_ENTRY Entry
)
{
PLIST_ENTRY OldBlink;
OldBlink = ListHead->Blink;
Entry->Flink = ListHead;
Entry->Blink = OldBlink;
OldBlink->Flink = Entry;
ListHead->Blink = Entry;
}
static __inline
VOID
InitializeListHead(
_Inout_ PLIST_ENTRY ListHead
)
{
ListHead->Flink = ListHead->Blink = ListHead;
}
extern LIST_ENTRY ContextListHead;
struct wgl_context
+4 -2
View File
@@ -437,11 +437,11 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
context->icd_data = dc_data->icd_data;
context->pixelformat = dc_data->pixelformat;
context->thread_id = 0;
context->magic = 'GLRC';
/* Insert into the list */
InsertTailList(&ContextListHead, &context->ListEntry);
context->magic = 'GLRC';
TRACE("Success!\n");
return (HGLRC)context;
}
@@ -504,9 +504,11 @@ HGLRC WINAPI wglCreateLayerContext(HDC hdc, int iLayerPlane)
context->icd_data = dc_data->icd_data;
context->pixelformat = dc_data->pixelformat;
context->thread_id = 0;
context->magic = 'GLRC';
/* Insert into the list */
InsertTailList(&ContextListHead, &context->ListEntry);
release_dc_data(dc_data);
return (HGLRC)context;
}