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

Panicking: Misaligned pointer dereference when sending client message #235

Closed
cartoon-raccoon opened this issue Jul 5, 2023 · 4 comments

Comments

@cartoon-raccoon
Copy link

cartoon-raccoon commented Jul 5, 2023

My program panics with a misaligned pointer dereference error when I try to send an event.
I'm sending a ClientMessage event from the root window.

Attached is the rust backtrace of the panic, with irrelevant function calls removed:
crashlog.txt

And this is the relevant code that's calling the function:

let event = x::ClientMessageEvent::new(
    // cast! is just calling <<type> as XidNew>::new(id)
    cast!(x::Window, window),
    cast!(x::Atom, data.type_),
    to_send // client message data
);

Ok(self.conn.check_request(self.conn.send_request_checked(
    &x::SendEvent{
        propagate: false,
        destination: x::SendEventDest::Window(cast!(x::Window, window)),
        event_mask: x::EventMask::NO_EVENT,
        event: &event,
    }
))?)

I am aware that cast! is calling unsafe code, but I'm fairly sure that all values that it's dealing with already exist on the server.

@rtbo
Copy link
Collaborator

rtbo commented Jul 8, 2023

Have you tested with the main branch?
This was very likely fixed by #229

@cartoon-raccoon
Copy link
Author

I'm using v1.2.1 from Crates.io. I'll do some further testing with the latest commit on the main branch to see if it's fixed.

@hydrobeam
Copy link

I was having a similar issue that was fixed by switching to the main branch.

Is there going to be a new release to make the fix available?

RealKC added a commit to RealKC/kcshot that referenced this issue Jul 18, 2023
RealKC added a commit to RealKC/kcshot that referenced this issue Jul 19, 2023
@rtbo
Copy link
Collaborator

rtbo commented Jul 22, 2023

v1.2.2 is published

@rtbo rtbo closed this as completed Jul 22, 2023
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

3 participants