juce_Singleton assigned twice


#1
 alreadyInside = true; \
                    classname* newObject = new classname();  /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
                    alreadyInside = false; \

Not a biggie, but hey! AlreadyInside is assigned twice in succession… haven’t bothered to check disassembly…


#2

Yeah, that’s deliberate!

Calling the constructor may invoke code that recursively tries to create the singleton, so the alreadyInside flag will catch that.