summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-02-12 20:28:53 -0500
committerFranklin Wei <git@fwei.tk>2017-02-12 20:36:31 -0500
commit0a9f71790bcad2c6ffdc96db59c446fe84336d40 (patch)
treec687ca180fa90656f528084226c0794a4c0b8869
parente4a04fa105b2e1349693b68d7088d9bbdd91d19b (diff)
downloadrockbox-0a9f717.tar.gz
rockbox-0a9f717.zip
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
-rw-r--r--apps/plugins/xworld/sys.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index b13d4fb9ed..eac47e66f0 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);*/
}