c++ - libspotify: Access violation reading location 0x00000000. (Windows) -
so, try specific playlist via uri this:
sp_link *link; sp_playlist *playlist; sp_playlist_callbacks playlist_callbacks = { 0 }; link = sp_link_create_from_string("spotify:user:spotify:playlist:2iy4blinjmogjx4qhcwnju"); playlist_callbacks.playlist_state_changed = playlist_state_changed; waitforsingleobject(lib_lock, infinite); playlist = sp_playlist_create(session, link); // <- program crashes here sp_playlist_add_callbacks(playlist, &playlist_callbacks, null); waitforsingleobject(lib_event_call_finished, infinite); releasemutex(lib_lock);
the callback following:
void sp_callconv playlist_state_changed(sp_playlist *playlist, void *user_data) { if (sp_playlist_is_loaded(playlist)) { setevent(lib_event_call_finished); } }
lib_lock
mutex (createmutex(null, false, null);
)
lib_event_call_finshed
event (createevent(null, false, false, null);
)
one word program's architecture:
i have thread executing above commands, created in main function. main function executes main loop:
while (true) { result = waitforsingleobject(lib_event_notify, next_timeout); if (result == wait_object_0 || result == wait_timeout) { { sp_session_process_events(session, &next_timeout); } while (next_timeout == 0); } else { err_msg("waitforsingleobject has failed"); } }
lib_event_notify
event, called when notify_main_thread
called.
when marked line executed following error visual studio:
unhandled exception @ 0x100a5550 (libspotify.dll) in prog.exe: 0xc0000005: access violation reading location 0x00000000.
Comments
Post a Comment