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

Segmentation fault on Image creation #307

Open
svenknobloch opened this issue Feb 21, 2020 · 3 comments
Open

Segmentation fault on Image creation #307

svenknobloch opened this issue Feb 21, 2020 · 3 comments

Comments

@svenknobloch
Copy link

Running on OSX 10.14 (Mojave)

Creation of image from console segfaults on this line when dereferencing the pixel pointer.

Minimalistic example that reproduces the error (happens on both Offscreen and Root):

let console = Offscreen::new(100, 100);
let image = Image::from_console(&console);
@tomassedovic
Copy link
Owner

Hey @svenknobloch, thanks for this!

Looks like this is an issue with the bundled libtcod source. This project uses by now a very old version and I suspect the best thing to do would be to update it.

There was an attempt at that here:

#290

But it stalled and unless someone's able to bring it to the finish line, it probably won't happen :-(. I have basically zero time/energy to work on tcod-rs these days.

@svenknobloch
Copy link
Author

That's understandable. I might take a look at it, since I would like to use it.

Also if the bundled version is causing the issue, do you think dynamically linking it with a newer installed version might work, just as a sanity check? Or would the new version not be compatible, binding-wise?

@tomassedovic
Copy link
Owner

I think if both versions use the same function headers (same arguments in the same order and the same return function) it should work. If not, you've got yourself another segfault.

If you just want something that works, an alternative might be to try RLTK: http://bfnightly.bracketproductions.com/rustbook/

or doryen-rs: https://github.com/jice-nospam/doryen-rs

They're both roguelike libs in pure Rust, so depending on what exactly you want to do, they might be worth looking at.

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

No branches or pull requests

2 participants