diff options
| author | Franklin Wei <git@fwei.tk> | 2017-02-12 20:28:53 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2017-02-12 20:36:31 -0500 |
| commit | 0a9f71790bcad2c6ffdc96db59c446fe84336d40 (patch) | |
| tree | c687ca180fa90656f528084226c0794a4c0b8869 /apps | |
| parent | e4a04fa105b2e1349693b68d7088d9bbdd91d19b (diff) | |
| download | rockbox-0a9f71790bcad2c6ffdc96db59c446fe84336d40.zip rockbox-0a9f71790bcad2c6ffdc96db59c446fe84336d40.tar.gz rockbox-0a9f71790bcad2c6ffdc96db59c446fe84336d40.tar.bz2 rockbox-0a9f71790bcad2c6ffdc96db59c446fe84336d40.tar.xz | |
xworld: fix several horrendous bugs
- unregisters timer on exit, preventing possible crash
- disables synchronization mechanisms when used from an IRQ
- prevents memory allocations from overflowing the audio buffer (unlikely)
Change-Id: I3c2c4ebe93c10ca9176ed0455e7aacc2d10c059e
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/plugins/xworld/sys.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c index b13d4fb..eac47e6 100644 --- a/apps/plugins/xworld/sys.c +++ b/apps/plugins/xworld/sys.c @@ -117,6 +117,7 @@ void exit_handler(void) { sys_save_settings(save_sys); sys_stopAudio(save_sys); + rb->timer_unregister(); #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif @@ -1114,7 +1115,8 @@ void *sys_get_buffer(struct System* sys, size_t sz) { void* ret = sys->membuf; rb->memset(ret, 0, sz); - sys->membuf += sz; + sys->membuf = (char*)(sys->membuf) + sz; + sys->bytes_left -= sz; return ret; } else @@ -1128,11 +1130,12 @@ void MutexStack(struct MutexStack_t* s, struct System *stub, void *mutex) { s->sys = stub; s->_mutex = mutex; - sys_lockMutex(s->sys, s->_mutex); + /* FW 2017-2-12: disabled; no blocking ops in IRQ context! */ + /*sys_lockMutex(s->sys, s->_mutex);*/ } void MutexStack_destroy(struct MutexStack_t* s) { - sys_unlockMutex(s->sys, s->_mutex); - + (void) s; + /*sys_unlockMutex(s->sys, s->_mutex);*/ } |