Okay, I've removed all instances of queue_free(). Instead, I've just hidden them when exiting an upgrade menu. They queue_free() themselves anyway after they fade out.
It's hard to say a transient bug like this is really gone for good, but I have not hit the problem since this fix. Thank you!