Fix use after free in transaction code
If we set an instruction as ready twice, it decreases the transaction's num_waiting a second time and applies the transaction earlier than it should. This no doubt has undesired effects, probably resulting in a use after free. Hopefully fixes the first part of #2207.
This commit is contained in:
parent
f414885b1d
commit
50b401677b
|
@ -377,9 +377,11 @@ static void set_instructions_ready(struct sway_view *view, int index) {
|
||||||
for (int i = 0; i <= index; ++i) {
|
for (int i = 0; i <= index; ++i) {
|
||||||
struct sway_transaction_instruction *instruction =
|
struct sway_transaction_instruction *instruction =
|
||||||
view->swayc->instructions->items[i];
|
view->swayc->instructions->items[i];
|
||||||
|
if (!instruction->ready) {
|
||||||
set_instruction_ready(instruction);
|
set_instruction_ready(instruction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transaction_notify_view_ready(struct sway_view *view, uint32_t serial) {
|
void transaction_notify_view_ready(struct sway_view *view, uint32_t serial) {
|
||||||
for (int i = 0; i < view->swayc->instructions->length; ++i) {
|
for (int i = 0; i < view->swayc->instructions->length; ++i) {
|
||||||
|
|
Loading…
Reference in a new issue