bug-zile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

zile undo bug crash at scratch


From: acoret
Subject: zile undo bug crash at scratch
Date: Sun, 17 Oct 2021 09:45:03 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

undo work pretty well with other buff or file, but it will crash at
*scratch* buff.

```shell

zile
<C+x> b
<enter> // switch to scratch buffer
<C+/> // undo
<C+/>

```
zile will just crash.

undo will save action even after undo is invoked.
but revert_action may lead last_undop into null, but undo_save still
invoke last_undop->prepend without check, so it lead to crash


```patch
--- zile-2.6.2/src/undo.vala
+++ zile-2.6.2/src/undo.vala
@@ -49,12 +49,12 @@
if (type == SAVE_BLOCK) {
u.size = size;
u.text = cur_bp.get_region (new Region (o, o + osize));
u.unchanged = !cur_bp.modified;
}
- if (cur_bp.last_undop != null)
- cur_bp.last_undop->prepend (u);
+
+ cur_bp.last_undop->prepend (u);
}
```




reply via email to

[Prev in Thread] Current Thread [Next in Thread]