Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracker crashes on setVisible on neko #1879

Closed
alihassan0 opened this issue Jul 1, 2016 · 2 comments
Closed

Tracker crashes on setVisible on neko #1879

alihassan0 opened this issue Jul 1, 2016 · 2 comments

Comments

@alihassan0
Copy link
Contributor

alihassan0 commented Jul 1, 2016

  • Flixel version: dev
  • OpenFL version: 3.6.1
  • Lime version: 2.9.1
  • Affected targets: Neko

Code snippet reproducing the issue:

package;

import flixel.FlxG;
import flixel.FlxState;
import flixel.system.debug.watch.Tracker;

class MenuState extends FlxState
{
    override public function create():Void
    {
        super.create();
        var car = new Car(20,"toyoto");
        FlxG.debugger.addTrackerProfile(new TrackerProfile(Car, ["speed", "model"]));
        var window = FlxG.debugger.track(car);
        trace(window);
        window.setVisible(false);
    }
}

class Car
{
    public var speed:Int;
    public var model:String;

    public function new(speed, model) {
        this.speed = speed;
        this.model = model;
    }
}

you need to test with debug flag lime test neko -debug


Observed behavior:

the game crashes on Neko

Invalid array access
Called from Array::__set line 311
Called from a C function
Called from flixel.system.debug.Window::setVisible line 251
Called from MenuState::create line 20
Called from flixel.FlxGame::switchState line 623
Called from flixel.FlxGame::create line 333
Called from openfl._legacy.events.EventDispatcher::dispatchEvent line 98
Called from a C function
Called from openfl._legacy.display.DisplayObject::dispatchEvent line 70
Called from openfl._legacy.display.DisplayObject::__onAdded line 362
Called from a C function
Called from openfl._legacy.display.DisplayObjectContainer::__onAdded line 379
Called from openfl._legacy.display.DisplayObject::__setParent line 423
Called from openfl._legacy.display.DisplayObjectContainer::addChild line 31
Called from Main::new line 11
Called from a C function
Called from DocumentClass::new line 217
Called from a C function
Called from DocumentClass::$init line 217
Called from a C function
Called from ApplicationMain::main line 119
Called from openfl._legacy.Lib::create line 122

Expected behavior:
the game runs normally with this tracker window hidden

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2016

I guess setVisible() is not supposed to be used on a Tracker window.. You can use window.visible = false; as a workaround, but I agree that it at least shouldn't crash.

@Gama11 Gama11 added the Bug label Jul 1, 2016
@alihassan0
Copy link
Contributor Author

the problem seems to be with this piece of logic :
https://github.com/HaxeFlixel/flixel/blob/dev/flixel/system/debug/Window.hx#L136

        if (Closable)
        {
            _closeButton = new FlxSystemButton(new GraphicCloseButton(0, 0), close);
            _closeButton.alpha = HEADER_ALPHA;
            addChild(_closeButton);
        }
        else 
        {
            _id = WINDOW_AMOUNT;
            loadSaveData();
            WINDOW_AMOUNT++;
}

it seems the window will only get an _id if it's not closable. and trackers are closable by default.
not sure why only non-closable windows should get an _id though ?!!

@Gama11 Gama11 closed this as completed in b0d42cc Jul 10, 2016
Aurel300 pushed a commit to larsiusprime/haxeflixel that referenced this issue Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants