Fix a bug in the node graph relating to attaching and detaching nodes.

This was setting the previous pointer of newly attached nodes to NULL
instead of a pointer to the dummy head node. This then results in the
dummy head node never being updated when the node is detached which in
turn results in an uninitialized node being dereferenced.
This commit is contained in:
David Reid
2021-01-14 17:23:48 +10:00
parent 416ead6e35
commit 687e9e5502
2 changed files with 11 additions and 4 deletions
+6 -3
View File
@@ -78,7 +78,7 @@ int main(int argc, char** argv)
loadNotification.cb.onSignal = on_sound_loaded;
loadNotification.pSound = &sound;
result = ma_sound_init_from_file(&engine, argv[1], /*MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC |*/ MA_DATA_SOURCE_FLAG_STREAM, &loadNotification, NULL, &sound);
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE /*| MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM*/, &loadNotification, NULL, &sound);
if (result != MA_SUCCESS) {
printf("Failed to load sound: %s\n", argv[1]);
ma_engine_uninit(&engine);
@@ -93,6 +93,8 @@ int main(int argc, char** argv)
}
#endif
/*ma_data_source_seek_to_pcm_frame(sound.pDataSource, 5000000);*/
//ma_sound_group_set_pan(ma_engine_get_master_sound_group(&engine), -1);
@@ -105,7 +107,7 @@ int main(int argc, char** argv)
/*ma_sound_set_volume(&sound, 0.25f);*/
/*ma_sound_set_pitch(&sound, 1.2f);*/
/*ma_sound_set_pan(&sound, 0.0f);*/
//ma_sound_set_looping(&sound, MA_TRUE);
ma_sound_set_looping(&sound, MA_TRUE);
//ma_sound_seek_to_pcm_frame(&sound, 6000000);
//ma_sound_set_start_time(&sound, 1110);
//ma_sound_set_volume(&sound, 0.5f);
@@ -116,6 +118,7 @@ int main(int argc, char** argv)
//ma_sound_set_volume(&sound, 1);
//ma_sound_set_start_time(&sound, 48000);
ma_sound_start(&sound);
/*ma_sound_uninit(&sound);*/
//ma_sleep(1000);
//ma_sound_set_looping(&sound2, MA_TRUE);
@@ -134,7 +137,7 @@ int main(int argc, char** argv)
ma_engine_play_sound(&engine, argv[3], NULL);*/
#endif
#if 1
#if 0
float pitch = 1;
float pitchStep = 0.01f;
float pitchMin = 0.125f;
+5 -1
View File
@@ -2493,7 +2493,7 @@ static void ma_node_input_bus_attach(ma_node_input_bus* pInputBus, ma_node_outpu
*/
ma_node_input_bus_lock(pInputBus);
{
ma_node_output_bus* pNewPrev = NULL;
ma_node_output_bus* pNewPrev = &pInputBus->head;
ma_node_output_bus* pNewNext = (ma_node_output_bus*)c89atomic_load_ptr(&pInputBus->head.pNext);
/* Update the local output bus. */
@@ -8714,6 +8714,10 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng
ma_engine_config engineConfig;
ma_context_config contextConfig;
if (pEngine != NULL) {
MA_ZERO_OBJECT(pEngine);
}
/* The config is allowed to be NULL in which case we use defaults for everything. */
if (pConfig != NULL) {
engineConfig = *pConfig;