Skip to content

Text node: updating text causing crash #133

@PawelRoman

Description

@PawelRoman

Kaaengine build v. 0.11+75.gbc2555f

Add Text node and on keyboard text event we try to update text node's text. When we do that, engine crashes with

Traceback (most recent call last):
  File "/home/pawel/Dev/gates-of-valhalla/demos/text_typing/main.py", line 34, in <module>
    engine.run(MyScene())
  File "engine.pxi", line 100, in kaa._kaa._Engine.run
kaa._kaa.KaacoreError: /host/kaacore/src/draw_unit.cpp:212 !(draw_unit_it != this->draw_units.end()) - Target draw unit not found, end of draw units vector reached.

Code to replicate the issue:

import logging
from logging import DEBUG

from kaa.fonts import TextNode
from kaa.geometry import Vector
from kaa.engine import Engine

from scenes.base import SceneBase

logging.basicConfig(level=DEBUG, format="%(levelname)s | %(asctime)s | %(module)s:%(lineno)d | %(message)s")


class MyScene(SceneBase):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.text_node = TextNode(font_size=40, text="", position=Vector(200, 200))
        self.root.add_child(self.text_node)

    def update(self, dt):
        for event in self.input.events():
            if event.keyboard_text:
                self.text_node.text = event.keyboard_text.text


if __name__ == "__main__":

    with Engine(virtual_resolution=Vector(1800, 900)) as engine:

        engine.window.size = Vector(1800, 900)
        engine.window.fullscreen = False
        engine.window.title = "Text typing"
        engine.window.center()
        engine.run(MyScene())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions