Ok, I should have noticed this before, but the condition If[initialized,Graphics...]
doesn't have an else clause. The documentation shows in the 3rd bullet under the Details section that
Details
If[condition,t]
gives Null if condition evaluates to False.
When I run your code, clicking on freeze causes that statement to evaluate to Null. Somehow, initialized
is getting set to False. I believe I verified this by inserting Echo[initialized]
as the else clause. For me, clicking freeze causes that statement to print False in the Messages window.
I noticed you have Dynamic nested inside Manipulate. Could be some race condition associated with that? I don't have an clear cut explanation, but if I get time I'll take another look. Possibly, this could be done without need of the nested Dynamic since Manipulate handles that use case very well. Just a thought.