Skip to content

GetImGuiPtrs seems to be returning invalid pointer #93

Open
@MrAdhit

Description

@MrAdhit

Hey,

So I'm trying to use this plugin on my Rust backend with gdext, I can call GetImGuiPtrs perfectly fine,
but when it comes to setting the current imgui context with the pointer returned by that function, it seems that the pointer is actually invalid, it's just pointing to a garbage memory, and when I try to destroy it (just to figure out if it's actually ImGuiContext* or not), the whole app just crashes.

Here's the code that I wrote.

        let obj = ClassDb::singleton().instantiate("ImGuiSync");

        unsafe {
            let ptrs: PackedInt64Array = obj.call("GetImGuiPtrs", &[
                Variant::from(CStr::from_ptr(ImGui::GetVersion()).to_str().unwrap()),
                Variant::from(size_of::<ImGuiIO>() as i32),
                Variant::from(size_of::<ImDrawVert>() as i32),
                Variant::from(size_of::<ImDrawIdx>() as i32),
                Variant::from(size_of::<ImWchar>() as i32),
            ]).to();

            ImGui::DestroyContext(transmute(ptrs[0]));
        }

I use this example , this, and this for reference
So I assume that I need to call GetImGuiPtrs

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