-
Notifications
You must be signed in to change notification settings - Fork 21
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
Draw/Cairo broken #210
Comments
FWIW it's been crashing for me before any of my changes. |
I wasn't suggesting it was your patch. :) I just rememberd it working before I pulled yesterday evening, but I'm not sure what commit I was at before. |
This is the segfault I get with gdb:
|
And here's a backtrace. Anyone an idea what I should be looking for?
|
A few signals just break. @jeremyletang you have an idea about what's wrong here ? |
Since the stuff I am currently working on depends on this, I wouldn't mind fixing this myself. Unfortunately I don't know where to start. |
Me neither unfortunately, it's mostly @jeremyletang who worked on it. I think you should start looking at signal.rs (that's where macros are created). It's broken since the old closure system has been removed. |
Well, the segfault seems to suggest it's this line (signal.rs:90):
|
This is a curious case. Somehow GTK seems to eat the
and here's what I get:
|
Well turns out the signal definition in |
Hum... That's surprising that it did work before the closure change then... |
Okay, I spoke too rashly... The struct in question is a wrapper around the pointer, it's a clever way to get a type conversion for free. So it can work but not always apparently. |
What I thought when I tried to fix that a while ago was about the "loss" of the pointer. That's where I got lost. |
This is because of how Rust implements destructors right now. They don't come for free. struct X;
#[repr(C)]
struct Y(*mut X);
#[repr(C)]
struct Z(*mut X);
impl Drop for Z { fn drop(&mut self) { } }
fn main() {
println!("sizeof(Y) = {}, sizeof(Z) = {}",
::std::mem::size_of::<Y>(),
::std::mem::size_of::<Z>());
} |
Yes, that's what we want. So why do we have a loss of pointer ? |
|
Okay, I get it now. Hum... I hate when it get annoying to do "simple" stuff like that. |
I was expecting we'd have to do this the hard way anyway -- do all of the conversions at the FFI boundary explicitly. |
I'm not sure this is necessary. I did really dirty stuff like that on other bindings without having to rewrite all the C-code in Rust. I definitely need more time to take care of that. |
Rewrite what? I mean make signal declarations a bit more tedious but in return have the |
Oh okay. I was going way too far away haha. |
@ptersilie You can unblock your progress for now by commenting out this |
Thanks @gkoz and @GuillaumeGomez. 👍 Commenting the |
I have no idea if this struct is (or could be) ever used other than in the |
Ah that makes sense then. Thanks for the explanation. :) So that means removing that |
A PR with the Drop implementation commented with the link to this discussion would be nice while we try to find out what's wrong. |
It seems like cairo (or at least connecting the draw function to a drawing area) is broken since the last big update. The example cairotest crashes instantly unless
is commented out.
The text was updated successfully, but these errors were encountered: