Stack overflow Injecting two models into each other

juri's Avatar


14 Nov, 2010 01:17 AM

Hello there,
i'm trying to inject two models (mapped with mapSingleton) into each other and keep getting "Error: Error #1023: Stack overflow occurred."

I'm a newbie so sorry in advance if it's a stupid question but.. what did i do wrong?

  1. 1 Posted by ZackPierce on 14 Nov, 2010 03:17 AM

    ZackPierce's Avatar

    Here's a work-around to avoid the overflow. mapValue essentially functions the same as mapSingleton, but with a pre-prepared object instance.

    var modelBInstance:ModelB = new ModelB();
    injector.mapValue(ModelB, modelBInstance);

    On a more pedantic note, it's probably worth asking yourself "why do these two models need direct access to each other, instead of using commands that access the two independently?"

  2. 2 Posted by juri on 14 Nov, 2010 09:53 AM

    juri's Avatar

    Actually, i just started learning RL (enthusiast so far) and got that error while migrating a project from PMVC. I could reproduct it even in a basic scenario and got curious about the approach to use in such a case.

    Your note is in fact not pedantic at all, that error made me wonder about those specific classes (that were two proxies in PMVC) and actually made me rethink their role in the application. Mine was probably a wrong approach, and RL made me notice it. Which, in my opinion, is one of the main framework purposes..

    So, many thanks to you and lots of love to RL :)

  3. Stray closed this discussion on 11 Feb, 2011 05:19 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac