mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +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)
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue