vle-forge / irritator

Other
5 stars 4 forks source link

Frequent death of application when clearing the simulation editor panel (Windows) #94

Open ynedelec3 opened 2 years ago

ynedelec3 commented 2 years ago

Hi After a long pause in Using Irritator I came back to the latest version and installed it on windows quite easily and successfully. However an assert instruction frequently kills the application when clearing (by clicking on "Clear" button) the simulation editor panel.

The line responsible for this is the commented one in :

template<typename Dynamics>
static void add_output_attribute(simulation_editor& ed,
                                 const Dynamics&    dyn) noexcept
{
    if constexpr (is_detected_v<has_output_port_t, Dynamics>) {
        const auto** names  = get_output_port_names<Dynamics>();
        const auto&  mdl    = get_model(dyn);
        const auto   mdl_id = ed.sim.models.get_id(mdl);

        sz i = 0;
        for ([[maybe_unused]] auto& elem : dyn.y) {
            irt_assert(i < 8u);

            //assert(ed.sim.models.try_to_get(mdl_id) == &mdl); //xxx Nedelec

            ImNodes::BeginOutputAttribute(make_output_node_id(mdl_id, (int)i),
                                          ImNodesPinShape_TriangleFilled);
            ImGui::TextUnformatted(names[i]);
            ImNodes::EndOutputAttribute();
            ++i;
        }
    }
}

[simulation-editor.cpp]

I couldn't identify a reason for these fatal errors nor any faulty order in instructions prior to its happening, it occurs after a while but sometimes quickly, sometimes after a few successful imports. I commented the instruction but I guess it's not a good idea.

It does not change the simulation quality so i just report the situation.

Have a nice summer Yves

quesnel commented 2 years ago

Hello,

Thank you for reporting. I will investigage the problem.

ynedelec3 commented 2 years ago

Hi The assert instruction appears in line 43 and line 67, both lines may bug (code pasted above comes from only one occurrence)