RealyUniqueName / StablexUI

UI engine for Haxe OpenFL designed to give as much freedom as possible in customizing UI
http://ui.stablex.ru/doc
Other
337 stars 80 forks source link

Segfault caused by recursion #193

Closed RudolfVonKrugstein closed 9 years ago

RudolfVonKrugstein commented 9 years ago

I have this example (derived from 02_first):

first.xml:

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

<HBox name="'contents'" layout:Column-cols="[-1,0]" padding="50">
    <Text name="'text'" text="'Hello'"/>
    <HBox name="'buttonBox'" autoSize="true" align="'center,middle'"/>
</HBox>

Main.hx:

package;

import flash.Lib;
import ru.stablex.ui.UIBuilder;
import ru.stablex.ui.widgets.Button;
import ru.stablex.ui.widgets.Box;

/**
* StablexUI example created in this manual: http://ui.stablex.ru/doc#manual/02_Basics.html
*/
class Main extends flash.display.Sprite{

    /**
    * Enrty point
    *
    */
    static public function main () : Void{
        Lib.current.stage.align     = flash.display.StageAlign.TOP_LEFT;
        Lib.current.stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;

        //initialize StablexUI
        UIBuilder.init();

        //Create UI and attach it to root display object
        var gui = UIBuilder.buildFn('first.xml')();
        Lib.current.addChild(gui);
        var button = UIBuilder.create(Button,{w : 32, h : 32});
        cast(gui.getChildByName('buttonBox'), Box).addChild(button);

    }//function main()

}//class Main

compiling and running this on linux gives a Bus error (core dumped). Using gdb I found out, that it seems to be a infinite recursion.

What I found out:

  1. The error occurs when adding the button child.
  2. removing the 'padding="50"' form the outer HBox solves the issue.
RudolfVonKrugstein commented 9 years ago

Well, the padding should be part of the layout. Still, this situation should result in a warning or something, not in a crash.