Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Alt+Click the heading folding triangle causing hang https://github.com/siyuan-note/siyuan/issues/10339

Daniel1c8e9c3f2594
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index cf7367863c..7887a6870e 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -176,7 +176,7 @@ func performTx(tx *Transaction) (ret *TxErr) {
msg := fmt.Sprintf("PANIC RECOVERED: %v\n\t%s\n", e, stack)
logging.LogErrorf(msg)
- if 0 == tx.state.Load() {
+ if 1 == tx.state.Load() {
tx.rollback()
return
}
@@ -1250,12 +1250,12 @@ type Transaction struct {
luteEngine *lute.Lute
m *sync.Mutex
- state atomic.Int32 // 0: 未提交,1: 已提交,2: 已回滚
+ state atomic.Int32 // 0: 初始化,1:未提交,:2: 已提交,3: 已回滚
}
func (tx *Transaction) WaitForCommit() {
for {
- if 0 == tx.state.Load() {
+ if 1 == tx.state.Load() {
time.Sleep(10 * time.Millisecond)
continue
}
@@ -1271,7 +1271,7 @@ func (tx *Transaction) begin() (err error) {
tx.nodes = map[string]*ast.Node{}
tx.luteEngine = util.NewLute()
tx.m.Lock()
- tx.state.Store(0)
+ tx.state.Store(1)
return
}
@@ -1284,14 +1284,14 @@ func (tx *Transaction) commit() (err error) {
refreshDynamicRefTexts(tx.nodes, tx.trees)
IncSync()
tx.trees = nil
- tx.state.Store(1)
+ tx.state.Store(2)
tx.m.Unlock()
return
}
func (tx *Transaction) rollback() {
tx.trees, tx.nodes = nil, nil
- tx.state.Store(2)
+ tx.state.Store(3)
tx.m.Unlock()
return
}