[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] How can evnt_multi cause an illegal access?



Hi,

I realize this is a little bit vague but I'm really out of ideas. How can this:

event = evnt_multi( MU_KEYBD | MU_MESAG | MU_BUTTON | MU_TIMER,
2, LEFT_BUTTON, 1, /* bclicks, bmask, bstate -- not used */
0, 0, 0, 0, 0, /* m1flag, m1x, m1y, m1w, m1h -- not used */
0, 0, 0, 0, 0, /* m2flag, m2x, m2y, m2w, m2h -- not used */
g_msgBuffer,
250, /* 250 ms = 0.25 second */
&mx, &my, &mb, /* mouse x, mouse y, mouse button */
&kstate, &key, /* shift state, key pressed */
&mc ); /* how many mouse clicks occured */

cause an illegal memory access (around 0x2000, sometimes 0x2010). g_msgBuffer is defined as:

short g_msgBuffer[8];

all the other variables are shorts, too.

Of course, it's not reliably reproducible. It happens only from time to time but I was able to catch it with debug outputs that it's really really this one. But it occurs often enough to annoy me. I could understand if my app corrupt something and it happens after 2 hours but no, it happens in the first iteration. If it survives, then it works. Always. Code before this call doesn't do anything strange, loads RSC, initializes protocols etc... there's really very small room to corrupt something so early. Complete file is here: https://sourceforge.net/p/mxplay/code/66/tree/trunk/main.c

So I don't know, what can go wrong here? I use cvs gemlib, xaaes etc.

--
MiKRO / Mystic Bytes
http://mikro.atari.org