Merge pull request #2496 from RyanDwyer/fix-transaction-crash

Fix crash when a view destroys with pending transactions
This commit is contained in:
Drew DeVault 2018-08-19 22:03:57 -04:00 committed by GitHub
commit fdcf9275b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,7 +175,9 @@ static void transaction_apply(struct sway_transaction *transaction) {
sizeof(struct sway_container_state)); sizeof(struct sway_container_state));
if (container->type == C_VIEW && container->sway_view->saved_buffer) { if (container->type == C_VIEW && container->sway_view->saved_buffer) {
view_remove_saved_buffer(container->sway_view); if (!container->destroying || container->ntxnrefs == 1) {
view_remove_saved_buffer(container->sway_view);
}
} }
// Damage the new location // Damage the new location
@ -283,7 +285,7 @@ static void transaction_commit(struct sway_transaction *transaction) {
struct timespec when; struct timespec when;
wlr_surface_send_frame_done(con->sway_view->surface, &when); wlr_surface_send_frame_done(con->sway_view->surface, &when);
} }
if (con->type == C_VIEW) { if (con->type == C_VIEW && !con->sway_view->saved_buffer) {
view_save_buffer(con->sway_view); view_save_buffer(con->sway_view);
memcpy(&con->sway_view->saved_geometry, &con->sway_view->geometry, memcpy(&con->sway_view->saved_geometry, &con->sway_view->geometry,
sizeof(struct wlr_box)); sizeof(struct wlr_box));