Compare commits

..
Author SHA1 Message Date
754dd6126d
fix: wrong dbus output (?) 2026-07-31 11:21:37 -07:00
26c17d5cf9
docs: add safety note 2026-07-31 11:14:05 -07:00
2 changed files with 13 additions and 1 deletions

View file

@ -21,7 +21,7 @@
dlDeps = with pkgs; [ dlDeps = with pkgs; [
# libdbus, for rfd # libdbus, for rfd
dbus dbus.lib
# needed for both x11 and wayland # needed for both x11 and wayland
libxkbcommon libxkbcommon

View file

@ -189,6 +189,18 @@ impl State {
widget::image::allocate(widget::image::Handle::from_rgba( widget::image::allocate(widget::image::Handle::from_rgba(
image.width(), image.width(),
image.height(), image.height(),
// SAFETY: this is a sort of race condition;
// will cause panics with large enough images,
// when they are edited consecutively.
//
// this can be reproduced by holding down 'i' with a 10k by 10k px image,
// which will invert the colors rapidly and eventually crash the app.
//
// however, that is not such a problem in this case,
// and I don't know a different way of doing this that doesn't copy
// (performance loss, which is can be pretty big)
// or likely cause flickering instead in such cases
// (like using Handle over Allocation to immediately drop the last one)
unsafe { std::mem::transmute::<&[u8], &'static [u8]>(image.as_bytes()) }, unsafe { std::mem::transmute::<&[u8], &'static [u8]>(image.as_bytes()) },
)) ))
.map(Message::ImageDisplayReady) .map(Message::ImageDisplayReady)