https://bugs.kde.org/show_bug.cgi?id=448087
--- Comment #6 from Andreas Grois <a...@grois.info> --- To be honest I haven't spent much thought on the RefCell idea. The plan would have been to replace Box::into_raw(Box::new(d_{})) by Box::into_raw(Box::new(RefCell::new(d_{}))) and all usages of that pointer, which now typically are (&*ptr), by (*ptr).borrow(). As those methods are only ever called from C++, I had assumed that all calls originate from the UI thread, but that's a restriction that the Rust bindings probably shouldn't impose on the C++ side... A Mutex at that point in the bindings would again impose unnecessary restrictions, as it would deadlock in all situations where there currently is Undefined Behaviour. What might work would be an RwLock, but the more I think about it, the less I think doing that is worthwhile, given that the original issue, aliasing a mutable pointer, is already resolved by limiting the code to immutable references, and any kind of guard introduced at that location would probably just serve as a debugging tool. For the moment I think I'll just leave the calls from C++ to Rust as they are, with raw pointers/references. -- You are receiving this mail because: You are watching all bug changes.