Skip to content

self.to_gd() in drop() causes (double) panic #1245

@ttencate

Description

@ttencate

Maybe the inverse problem of #557.

#[derive(GodotClass)]
#[class(init, base=RefCounted)]
struct AccessGdOnDrop {
    base: Base<RefCounted>,
}

impl Drop for AccessGdOnDrop {
    fn drop(&mut self) {
        // This causes a panic.
        self.to_gd();
    }
}

#[itest]
fn access_gd_on_drop() {
    let obj = AccessGdOnDrop::new_gd();
    drop(obj);
}

This gives a panic (message copied from my actual game, the above seems to outright abort):

ERROR: [panic .../godot-core-0.3.1/src/obj/raw_gd.rs:201]
  object expected to inherit RefCounted

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: registerRegister classes, functions and other symbols to GDScriptfeatureAdds functionality to the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions