asmodehn / sdlut

SDL utility toolkit - A C++ wrapper arount SDL 1.2
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Bug on timer launch #4

Open asmodehn opened 10 years ago

asmodehn commented 10 years ago

XorfacX: When launching a timer w an interval of 1, it seems that sometimes the timer wont launch. I get an assertion : "iterator not compatible" or "iterator not deferencable" (on the timer map ?). Prehaps it has something to do w launching/stopping too much timer at the same time? or map full (is that even possible?) How the code will handle when launching a timer while stopping another one, is there some king of mutex ?

asmodehn commented 10 years ago

XorfacX: Still not solved but i think we need to make "old" timers error bullet proof. Im not talking about solving the bug as we still have no clue, but more about using try/throw everywhere in order to, at least, return an error instead of simply crashing like it happen now. Like that i will be able to deal with the error and the game wont crash stupidly on a failed monster movement for example coz i will be able to ignore the failed movement or use a work around of some sort.

asmodehn commented 10 years ago

Not sure the failed movement is an exception but worth a try... You dont need to put that everywhere. just in your main, and in you callbacks maybe, and you should get the exceptions. PS : I am not so sure how exceptions would work along with threads... threads are not part of the C++ standard, they are part of the low-level platform calls ( C )... so it might be quite random depending on platform, compilers, etc. Anyway, I think the old timers are too complex to be easily maintainable. We should fix them now for sure, but in the future we should focus on getting the new Timers working properly...

asmodehn commented 10 years ago

XorfacX: I already handle error in my callback and the function that launch it but it's not enough. When launching the timer sometimes its simply crash without returning the failed statement expected. That's what i want to fix on old timers, not themselves directly (except if im able to i doubt it ;)) Ill work into it as soon i have some time. At least on win32 thread error handle themselves correctly plus i dont have any and callbacks work great on this part when u know how to be kind w them ;) On NewTimer, they must be really debugged but thats another story ;) Also i cant use them at their development stage due to their completely erratic behavior.