TextField crashing when selecting text

Hello,

I’ve noticed an issue that occurs with an openfl.textfield when selecting text. It no longer highlights the text, and instead just crashes the whole application. This only started happening after I updated openfl to 8.9.5 (from 8.9.0), so I do not think it is my own code. Reverting to 8.9.0 results in the bug disappearing, so it is probably the result of a change made between 8.9.0 and 8.9.5.

Changing _textField.selectable to false prevents the crash, but also prevents being able to select the text in the first place.

Here’s the code I use to make the textfield below. Hopefully this provides some more information.

		_textField = new TextField();
		_textField.embedFonts = true;
		_textField.defaultTextFormat = new TextFormat(font, Std.int(Settings.gameTextSize));
		_textField.x = 0;
		_textField.y = 24 * oflScaleY;
		_textField.width = 640 * oflScaleY;
		_textField.height = 326 * oflScaleY;
		_textField.textColor = _textFieldColour;
		_textField.htmlText = InputData._mainText;
		_textField.type = TextFieldType.DYNAMIC;
		_textField.multiline = false;
		_textField.wordWrap = true;
		_textField.border = false;
		_textField.borderColor = FlxColor.WHITE;
		_textField.backgroundColor = FlxColor.BLACK;
		_textField.selectable = true;
		_textField.scrollV = _textField.text.length;
		_textField.mouseWheelEnabled = true;

Hope this helps!

I think the crash is fixed in the dev build, perhaps it’s this commit?

or probably not this

Quite possibly! How exactly would I go about getting the developer build?

Edit: Pain in the arse to get it working, but I’ve managed to get it to go. The bug’s been fixed in the dev build, w00t! :smiley:

1 Like