Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected segfault #832

Closed
davidhesselbom opened this issue Sep 26, 2014 · 2 comments
Closed

Unexpected segfault #832

davidhesselbom opened this issue Sep 26, 2014 · 2 comments
Milestone

Comments

@davidhesselbom
Copy link
Contributor

@davidhesselbom davidhesselbom commented Sep 26, 2014

This causes a segfault:

Foo: cover {
    pointer : Int*
    init: func {
        this pointer = gc_malloc(1024)
    }
    dispose: func {
        gc_free(this pointer)
    }
}

foo := Foo new()
foo dispose()

This does not...

Foo: cover {
    pointer : Int*
    init: func {
        this pointer = gc_malloc(1024)
        gc_free(this pointer)
    }
    dispose: func {
    }
}

foo := Foo new()
foo dispose()

And neither does this:

Foo: cover {
    pointer : Int*
    init: func {
        this pointer = gc_malloc(1024)
        this dispose()
    }
    dispose: func {
        gc_free(this pointer)
    }
}

foo := Foo new()

What's going on here?

@davidhesselbom
Copy link
Contributor Author

@davidhesselbom davidhesselbom commented Sep 26, 2014

Argh, I needed init: func@ {. I've made that mistake a few times now... Maybe a warning would be nice, I don't know.

Loading

@alexnask
Copy link
Collaborator

@alexnask alexnask commented Sep 26, 2014

A "modifying this in a by value cover call" would be nice, indeed

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants