Recursive call when registering callback when inside callback

Create issue
Issue #132 resolved
Former user created an issue

Automatic migration. Original reporter: "vr"

Hi.

I have a problem where I register a callback for a button when inside the callback for that button. Code attached.

What happens is that I get a recursive call because during the registration of the callback, the callback dispatcher recognizes that its being activated, which spawns the callback, which then registrates the callback.

output from the code below:

Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup Callback In setup

Reproducibility: always

Additional information: --The luascript:

function callback(args) print("Callback") setup() end

function setup() print("In setup") local winMgr = CEGUI.WindowManager:getSingleton() local button = winMgr:getWindow("button") assert(button) button:subscribeEvent("Clicked", "callback") end

-- do the initialization setup()

-- The layoutfile: <?xml version="1.0" encoding="UTF-8"?>

<GUILayout > <Window Type="DefaultWindow" Name="Root" > <Property Name="InheritsAlpha" Value="False" /> <Property Name="UnifiedMaxSize" Value="1,0},{1,0" /> <Property Name="UnifiedAreaRect" Value="0,0},{0,0},{1,0},{1,0" /> <Window Type="WindowsLook/Button" Name="button" > <Property Name="Font" Value="DejaVuSans-8" /> <Property Name="Text" Value="press me" /> <Property Name="UnifiedMaxSize" Value="1,0},{1,0" /> <Property Name="UnifiedAreaRect" Value="0.3,0},{0.3,0},{0.55,0},{0.55,0" /> </Window> </Window> </GUILayout>

Comments (2)

  1. Former user Account Deleted

    Original reporter: kokoro-sama

    While this bug may exist, I am left to wonder where it will have application if resolved. Where is there a situation where you need to register a callback inside of the very callback you are trying to register?

    Need more feedback on this bug.

  2. Log in to comment