aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-08-02 08:10:16 -0400
committerGitHub <noreply@github.com>2018-08-02 08:10:16 -0400
commit23b5124a4de05558345f14b3cbe320e11869eb6f (patch)
treea028e5570d62f8500254e145bc489c1ec0cc6e9b
parenteec25ce60e17590c9c5c2004b9d133692131d65d (diff)
parent8314019f660cd28fc8cdb634f82b437105074258 (diff)
downloadsway-23b5124a4de05558345f14b3cbe320e11869eb6f.zip
sway-23b5124a4de05558345f14b3cbe320e11869eb6f.tar.gz
sway-23b5124a4de05558345f14b3cbe320e11869eb6f.tar.bz2
Merge pull request #2403 from RyanDwyer/fix-transaction-unmap
Fix race condition crashes when unmapping views
-rw-r--r--sway/desktop/transaction.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 9407036..4e6af86 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -195,11 +195,18 @@ static void transaction_apply(struct sway_transaction *transaction) {
sizeof(struct sway_container_state));
if (container->type == C_VIEW) {
- if (container->sway_view->saved_buffer) {
- view_remove_saved_buffer(container->sway_view);
- }
- if (container->instructions->length > 1) {
- view_save_buffer(container->sway_view);
+ if (container->destroying) {
+ if (container->instructions->length == 1 &&
+ container->sway_view->saved_buffer) {
+ view_remove_saved_buffer(container->sway_view);
+ }
+ } else {
+ if (container->sway_view->saved_buffer) {
+ view_remove_saved_buffer(container->sway_view);
+ }
+ if (container->instructions->length > 1) {
+ view_save_buffer(container->sway_view);
+ }
}
}
}
@@ -276,9 +283,9 @@ static void transaction_commit(struct sway_transaction *transaction) {
// mapping and its default geometry doesn't intersect an output.
struct timespec when;
wlr_surface_send_frame_done(con->sway_view->surface, &when);
- if (!con->sway_view->saved_buffer) {
- view_save_buffer(con->sway_view);
- }
+ }
+ if (con->type == C_VIEW && !con->sway_view->saved_buffer) {
+ view_save_buffer(con->sway_view);
}
list_add(con->instructions, instruction);
}