Huw Davies (@huw) commented about dlls/sapi/async.c:
+#include "wine/heap.h" +#include "wine/list.h" +#include "wine/debug.h"
+#include "sapi_private.h"
+WINE_DEFAULT_DEBUG_CHANNEL(sapi);
+static struct async_task *async_dequeue_task(struct async_queue *queue) +{
- struct async_task *task;
- EnterCriticalSection(&queue->cs);
- task = LIST_ENTRY(list_head(&queue->tasks), struct async_task, entry);
- if (task) list_remove(&task->entry);
`list_head()` will return `NULL` on empty list, `LIST_ENTRY()` will then add an offset to that, so you want to test the return value of `list_head()` here, not `task`.