I do not know how lite-c compiles code or wait works internally but yes,

Doing stuff like below sometimes resulted in random crashes:

Code:
void someAction(ENTITY* e){
....
PANEL* a = pan_create(...)
....
while(something){

  //using a/e here sometimes causes strange behaviour, mostly crash

  wait(1);
}
//also here
}



I say "sometimes", mostly it works as intended. I encountered it several times to remember it happening, when you mix wait_for and ptr_remove and juggle pointers around you encounter it at some point. Reducing number of wait/wait_for's or moving things to global scope gets rid of the issue. I only use one wait in main loop and PRAGMA_POINTER since a loong time but:

One workaround was this (apart from moving to global scope):

Code:
void someAction(){
....
PANEL* a = pan_create(...)
me.skill15 = (var)a;
....
while(something){
  a = (PANEL*) me.skill15;
  //no crash anymore when using a
  wait(1);
}
}




Think of the above code as a healthbar panel code for a couple of rts character like entities, just before crash you would see healthbars start positioning incorrectly, then you get the crash. Mostly while trying to remove some of them.

It could be unrelated or related to something else(can't guess what lite-c compiler does) but because of the fix above and moving to global fixing the issue, i always had the impression that somehow pointer the "a" loses it's value. (it could not have been moved around because me.skill15 points to same address, it can only mean "a" loses the address), when a loses the address ptr_remove crashes.

I could not reproduce the "sometimes" scenario in latest A8 but, it could be that it's fixed since then or my test code is not complex enough to confuse lite-c compiler. I am not doing anything complex with lite-c since a long time, and using only one wait even longer than that, so it's most likely fixed in early versions of A7.




Last edited by Quad; 07/03/18 19:58.

3333333333