mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🐛 Alt+Click the heading folding triangle causing hang https://github.com/siyuan-note/siyuan/issues/10339
This commit is contained in:
parent
351cc9ce25
commit
1c8e9c3f25
1 changed files with 6 additions and 6 deletions
|
|
@ -176,7 +176,7 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
||||||
msg := fmt.Sprintf("PANIC RECOVERED: %v\n\t%s\n", e, stack)
|
msg := fmt.Sprintf("PANIC RECOVERED: %v\n\t%s\n", e, stack)
|
||||||
logging.LogErrorf(msg)
|
logging.LogErrorf(msg)
|
||||||
|
|
||||||
if 0 == tx.state.Load() {
|
if 1 == tx.state.Load() {
|
||||||
tx.rollback()
|
tx.rollback()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1250,12 +1250,12 @@ type Transaction struct {
|
||||||
|
|
||||||
luteEngine *lute.Lute
|
luteEngine *lute.Lute
|
||||||
m *sync.Mutex
|
m *sync.Mutex
|
||||||
state atomic.Int32 // 0: 未提交,1: 已提交,2: 已回滚
|
state atomic.Int32 // 0: 初始化,1:未提交,:2: 已提交,3: 已回滚
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *Transaction) WaitForCommit() {
|
func (tx *Transaction) WaitForCommit() {
|
||||||
for {
|
for {
|
||||||
if 0 == tx.state.Load() {
|
if 1 == tx.state.Load() {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -1271,7 +1271,7 @@ func (tx *Transaction) begin() (err error) {
|
||||||
tx.nodes = map[string]*ast.Node{}
|
tx.nodes = map[string]*ast.Node{}
|
||||||
tx.luteEngine = util.NewLute()
|
tx.luteEngine = util.NewLute()
|
||||||
tx.m.Lock()
|
tx.m.Lock()
|
||||||
tx.state.Store(0)
|
tx.state.Store(1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1284,14 +1284,14 @@ func (tx *Transaction) commit() (err error) {
|
||||||
refreshDynamicRefTexts(tx.nodes, tx.trees)
|
refreshDynamicRefTexts(tx.nodes, tx.trees)
|
||||||
IncSync()
|
IncSync()
|
||||||
tx.trees = nil
|
tx.trees = nil
|
||||||
tx.state.Store(1)
|
tx.state.Store(2)
|
||||||
tx.m.Unlock()
|
tx.m.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *Transaction) rollback() {
|
func (tx *Transaction) rollback() {
|
||||||
tx.trees, tx.nodes = nil, nil
|
tx.trees, tx.nodes = nil, nil
|
||||||
tx.state.Store(2)
|
tx.state.Store(3)
|
||||||
tx.m.Unlock()
|
tx.m.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue