-
Notifications
You must be signed in to change notification settings - Fork 10
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
Crash in messages #24
Comments
Woops, I've been very busy the past few months. I'll look into it :) You're correct that this is something the |
@rhn The easiest solution would be to remove the implementation of the Alternatively, I could wrap the marker for |
@rhn It's been quite a while since I looked at this. It seems it should be possible to implement a conditional drop akin to |
In general, should invalid operations be prevented? If For example this will panic: fn main() -> Result<(), notmuch::Error> {
let database = notmuch::Database::open_with_config(
Some("/tmp/notmuch"),
notmuch::DatabaseMode::ReadWrite,
Some(""),
None,
)?;
let mut messages = database.create_query("*")?.search_messages()?;
let message = messages.next().unwrap();
// Would cache the ID and the next call wouldn't panic.
// println!("{}", message.id());
database.close()?;
// thread 'main' panicked at 'assertion failed: !self.is_null()', .../.cargo/registry/src/github.com-1ecc6299db9ec823/notmuch-0.8.0/src/utils.rs:33:13
println!("{}", message.id());
Ok(())
} This could be made impossible by, for example:
|
As it turns out, a
Messages
must be held until allMessage
object are dropped. It seems like something theMessageOwner
trait is supposed to cover.I've created a fail case (unfortunately, I didn't manage to test it on the corpus):
https://github.com/rhn/notmuch-rs/tree/messages_break
I'll happily turn this into an actual test case if the bug is fixed.
The text was updated successfully, but these errors were encountered: