Skip to content
Snippets Groups Projects
Commit 5f6425f0 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard
Browse files

xactengine3_7: Remove entry after FAudio Destroyed call.


FACTWaveBank_Destroy will invoke the callback which we
attempt to lookup the wavebank.

The callback must have a pointer, help states it isn't valid but still
points to the wavebank that was destroyed.

Signed-off-by: default avatarAlistair Leslie-Hughes <leslie_alistair@hotmail.com>
parent 3d25202e
No related branches found
No related tags found
No related merge requests found
......@@ -172,9 +172,11 @@ static void WINAPI notification_cb(const XACT_NOTIFICATION *notification)
data->received = TRUE;
ok(notification->type == data->type,
"Unexpected notification type %u\n", notification->type);
todo_wine_if(notification->type == XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED)
ok(notification->waveBank.pWaveBank == data->wave_bank, "Unexpected wave bank %p instead of %p\n",
if(notification->type == XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED)
{
ok(notification->waveBank.pWaveBank == data->wave_bank, "Unexpected wave bank %p instead of %p\n",
notification->waveBank.pWaveBank, data->wave_bank);
}
ok(thread_id == data->thread_id, "Unexpected thread id %#lx instead of %#lx\n", thread_id, data->thread_id);
}
......
......@@ -60,6 +60,21 @@ struct wrapper_lookup
void *xact;
};
typedef struct _XACT3EngineImpl {
IXACT3Engine IXACT3Engine_iface;
FACTAudioEngine *fact_engine;
XACT_READFILE_CALLBACK pReadFile;
XACT_GETOVERLAPPEDRESULT_CALLBACK pGetOverlappedResult;
XACT_NOTIFICATION_CALLBACK notification_callback;
void *wb_prepared_context;
void *wb_destroyed_context;
struct wine_rb_tree wb_wrapper_lookup;
CRITICAL_SECTION wb_wrapper_lookup_cs;
} XACT3EngineImpl;
static int wrapper_lookup_compare(const void *key, const struct wine_rb_entry *entry)
{
struct wrapper_lookup *lookup = WINE_RB_ENTRY_VALUE(entry, struct wrapper_lookup, entry);
......@@ -74,20 +89,30 @@ static void wrapper_lookup_destroy(struct wine_rb_entry *entry, void *context)
HeapFree(GetProcessHeap(), 0, lookup);
}
typedef struct _XACT3EngineImpl {
IXACT3Engine IXACT3Engine_iface;
static void wrapper_remove_entry(XACT3EngineImpl *engine, void *key)
{
struct wrapper_lookup *lookup;
struct wine_rb_entry *entry;
FACTAudioEngine *fact_engine;
EnterCriticalSection(&engine->wb_wrapper_lookup_cs);
XACT_READFILE_CALLBACK pReadFile;
XACT_GETOVERLAPPEDRESULT_CALLBACK pGetOverlappedResult;
XACT_NOTIFICATION_CALLBACK notification_callback;
entry = wine_rb_get(&engine->wb_wrapper_lookup, key);
if (!entry)
{
LeaveCriticalSection(&engine->wb_wrapper_lookup_cs);
void *wb_prepared_context;
void *wb_destroyed_context;
struct wine_rb_tree wb_wrapper_lookup;
CRITICAL_SECTION wb_wrapper_lookup_cs;
} XACT3EngineImpl;
WARN("cannot find key in wrapper lookup\n");
}
else
{
wine_rb_remove(&engine->wb_wrapper_lookup, entry);
LeaveCriticalSection(&engine->wb_wrapper_lookup_cs);
lookup = WINE_RB_ENTRY_VALUE(entry, struct wrapper_lookup, entry);
HeapFree(GetProcessHeap(), 0, lookup);
}
}
typedef struct _XACT3CueImpl {
IXACT3Cue IXACT3Cue_iface;
......@@ -591,33 +616,14 @@ static inline XACT3WaveBankImpl *impl_from_IXACT3WaveBank(IXACT3WaveBank *iface)
static HRESULT WINAPI IXACT3WaveBankImpl_Destroy(IXACT3WaveBank *iface)
{
XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface);
struct wrapper_lookup *lookup;
struct wine_rb_entry *entry;
HRESULT hr;
TRACE("(%p)\n", This);
EnterCriticalSection(&This->engine->wb_wrapper_lookup_cs);
entry = wine_rb_get(&This->engine->wb_wrapper_lookup, This->fact_wavebank);
if (!entry)
{
LeaveCriticalSection(&This->engine->wb_wrapper_lookup_cs);
WARN("cannot find wave bank in wrapper lookup\n");
}
else
{
wine_rb_remove(&This->engine->wb_wrapper_lookup, entry);
hr = FACTWaveBank_Destroy(This->fact_wavebank);
LeaveCriticalSection(&This->engine->wb_wrapper_lookup_cs);
wrapper_remove_entry(This->engine, This->fact_wavebank);
lookup = WINE_RB_ENTRY_VALUE(entry, struct wrapper_lookup, entry);
HeapFree(GetProcessHeap(), 0, lookup);
}
hr = FACTWaveBank_Destroy(This->fact_wavebank);
HeapFree(GetProcessHeap(), 0, This);
return hr;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment