Skip to content

memory access error for Examples\UI\HelloWorld #131

@slkom

Description

@slkom

Examples\UI\HelloWorld\Sources\helloworld.cpp
Code:
// Create a popup window as hint on the label.
label->slots.connect(label->sig_pointer_enter(), [&](PointerEvent &e)
{
....
std::weak_ptr popup_weak = popup;
popup->slots.connect(label->sig_pointer_leave(), [&](PointerEvent &e)
{
auto p = popup_weak.lock(); // no longer exist
if (p)
p->dismiss();
});

	window_manager->present_popup(label.get(), e.pos(label) + Pointf(10.0f, 10.0f), popup);
});

maybe the solution is:
....
static std::weak_ptr popup_weak = popup;
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions