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

sqlite: use Arc<> around StatementHandle instead of Copying it #1186

Closed
wants to merge 2 commits into from

Conversation

link2xt
Copy link
Contributor

@link2xt link2xt commented Apr 23, 2021

No description provided.

link2xt added 2 commits April 23, 2021 00:00
This guarantees that StatementHandle is never used after calling
`sqlite3_finalize`. Now `sqlite3_finalize` is only called when
StatementHandle is dropped.
Otherwise some tests fail to close connection.
@link2xt
Copy link
Contributor Author

link2xt commented Apr 23, 2021

This is an attempt to fix persistent segfaults in sqlite3_step: deltachat/deltachat-core-rust#2378 (comment)

Comment on lines +38 to +43
let resp = match status {
SQLITE_ROW => Ok(Either::Right(())),
SQLITE_DONE => Ok(Either::Left(statement.changes())),
_ => Err(statement.last_error().into()),
};
resp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let resp = match status {
SQLITE_ROW => Ok(Either::Right(())),
SQLITE_DONE => Ok(Either::Left(statement.changes())),
_ => Err(statement.last_error().into()),
};
resp
match status {
SQLITE_ROW => Ok(Either::Right(())),
SQLITE_DONE => Ok(Either::Left(statement.changes())),
_ => Err(statement.last_error().into()),
}

resp
} else {
// Statement is already finalized.
Err(Error::WorkerCrashed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, the worker didn't actually crash here. I'd consider a different error variant, maybe even a new one if none of the existing fit.

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

Successfully merging this pull request may close these issues.

2 participants