🐛 索引嵌入块内容可能会导致内核崩溃 https://github.com/siyuan-note/siyuan/issues/7213

This commit is contained in:
Liang Ding 2023-01-31 17:28:47 +08:00
parent dbf6965c30
commit 204580bf36
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 29 additions and 14 deletions

View file

@ -66,12 +66,7 @@ func updateRootContent(tx *sql.Tx, content, updated, id string) (err error) {
return
}
func UpdateBlockContent(block *Block) {
tx, err := beginTx()
if nil != err {
return
}
func updateBlockContent(tx *sql.Tx, block *Block) (err error) {
stmt := "UPDATE blocks SET content = ? WHERE id = ?"
if err = execStmtTx(tx, stmt, block.Content, block.ID); nil != err {
tx.Rollback()
@ -89,6 +84,7 @@ func UpdateBlockContent(block *Block) {
return
}
}
tx.Commit()
putBlockCache(block)
return
}