Merge pull request #2531 from RyanDwyer/maybe-fix-transaction-crash
Don't use bitfield to test for similar transactions
This commit is contained in:
commit
3686724c9e
|
@ -22,7 +22,6 @@ struct sway_transaction {
|
||||||
list_t *instructions; // struct sway_transaction_instruction *
|
list_t *instructions; // struct sway_transaction_instruction *
|
||||||
size_t num_waiting;
|
size_t num_waiting;
|
||||||
size_t num_configures;
|
size_t num_configures;
|
||||||
uint32_t con_ids; // Bitwise XOR of view container IDs
|
|
||||||
struct timespec commit_time;
|
struct timespec commit_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -228,6 +227,22 @@ static void transaction_apply(struct sway_transaction *transaction) {
|
||||||
|
|
||||||
static void transaction_commit(struct sway_transaction *transaction);
|
static void transaction_commit(struct sway_transaction *transaction);
|
||||||
|
|
||||||
|
// Return true if both transactions operate on the same containers
|
||||||
|
static bool transaction_same_containers(struct sway_transaction *a,
|
||||||
|
struct sway_transaction *b) {
|
||||||
|
if (a->instructions->length != b->instructions->length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < a->instructions->length; ++i) {
|
||||||
|
struct sway_transaction_instruction *a_inst = a->instructions->items[i];
|
||||||
|
struct sway_transaction_instruction *b_inst = b->instructions->items[i];
|
||||||
|
if (a_inst->container != b_inst->container) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void transaction_progress_queue() {
|
static void transaction_progress_queue() {
|
||||||
if (!server.transactions->length) {
|
if (!server.transactions->length) {
|
||||||
return;
|
return;
|
||||||
|
@ -252,7 +267,7 @@ static void transaction_progress_queue() {
|
||||||
while (server.transactions->length >= 2) {
|
while (server.transactions->length >= 2) {
|
||||||
struct sway_transaction *a = server.transactions->items[0];
|
struct sway_transaction *a = server.transactions->items[0];
|
||||||
struct sway_transaction *b = server.transactions->items[1];
|
struct sway_transaction *b = server.transactions->items[1];
|
||||||
if (a->con_ids == b->con_ids) {
|
if (transaction_same_containers(a, b)) {
|
||||||
list_del(server.transactions, 0);
|
list_del(server.transactions, 0);
|
||||||
transaction_destroy(a);
|
transaction_destroy(a);
|
||||||
} else {
|
} else {
|
||||||
|
@ -304,7 +319,6 @@ static void transaction_commit(struct sway_transaction *transaction) {
|
||||||
instruction->state.view_width,
|
instruction->state.view_width,
|
||||||
instruction->state.view_height);
|
instruction->state.view_height);
|
||||||
++transaction->num_waiting;
|
++transaction->num_waiting;
|
||||||
transaction->con_ids ^= con->id;
|
|
||||||
|
|
||||||
// From here on we are rendering a saved buffer of the view, which
|
// From here on we are rendering a saved buffer of the view, which
|
||||||
// means we can send a frame done event to make the client redraw it
|
// means we can send a frame done event to make the client redraw it
|
||||||
|
|
Loading…
Reference in a new issue