typedef struct {
int value;
} PTR;
void processPointer( PTR **p ) {
wait(1); //the wait causes **p to be invalid
*p = (PTR*)malloc(sizeof( PTR ));
(*p)->value = 1;
}
void main() {
PTR* p = NULL;
processPointer( &p );
while( !p ) {
draw_text("Still in while loop...", 10, 10, vector(255, 255, 50));
wait(1);
}
error("check!");
}
As stated, the
wait(1); in
processPointer() makes the **p pointer become invalid somehow. At least, the
error("check!"); is never called when the
processPointer() function waits one frame. If I comment out the wait, the "check!" error pops up as expected.
I can't see any reason why this would happen further than that waiting a frame screws up...