Well the fact is thay is only an example of the flawed points in your code.
Which apart for some naive things like using a vector to store elements you...singularly allocated (I'm looking at those monsters....) it's not THAT bas as you state in the OP...there's just a bit of WAY TOO MUCH BOILERPLATE, but that's fine.
The problem is I can't really follow along your code, how it "flows".
You said that you get the SEGFAULT only the SECOND time you run over the 'got_event' bit...is this still the case after Edgar's suggestion?
The reason i am using these functions is to allow the program extra time to process tasks if it is needed, this way you won't get a back log of render/logic tasks creating a more steady frame rate
Barring my difficulties in understanding the code (which are there!) I don't think this would be the case since ouy're counting frames but not checking how much time you spend in logic.
Anyway I would suggest you drop this kind of optimization for now, it's quite an advanced topic...unlikely you will need that now.
On the other hand, I've (mentally) simulated two consecutive runs of the innner loop but can't find a good reason for al_get_next_event throw a fit without reason....it is very very very likely that the second time that is called there is no event (maybe also the first), but in that case that is clearly guarded but the bool check right after.
I now strongly suspect there's an unmatched closing curly brace somewhere...