diff --git a/src/wayland/data_device/dnd_grab.rs b/src/wayland/data_device/dnd_grab.rs index 3ff7791..59a3876 100644 --- a/src/wayland/data_device/dnd_grab.rs +++ b/src/wayland/data_device/dnd_grab.rs @@ -273,24 +273,28 @@ fn implement_dnd_data_offer( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer that is no longer active.".into(), ); + return; } if !data.accepted { offer.as_ref().post_error( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer that has not been accepted.".into(), ); + return; } if !data.dropped { offer.as_ref().post_error( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer that has not been dropped.".into(), ); + return; } if data.chosen_action.is_empty() { offer.as_ref().post_error( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer with no valid action.".into(), ); + return; } source.dnd_finished(); data.active = false; @@ -309,6 +313,7 @@ fn implement_dnd_data_offer( wl_data_offer::Error::InvalidAction as u32, "Invalid preferred action.".into(), ); + return; } let source_actions = with_source_metadata(&source, |meta| meta.dnd_action) .unwrap_or_else(|_| DndAction::empty()); diff --git a/src/wayland/data_device/server_dnd_grab.rs b/src/wayland/data_device/server_dnd_grab.rs index 454d1d7..fd9e447 100644 --- a/src/wayland/data_device/server_dnd_grab.rs +++ b/src/wayland/data_device/server_dnd_grab.rs @@ -268,24 +268,28 @@ where wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer that is no longer active.".into(), ); + return; } if !data.accepted { offer.as_ref().post_error( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer that has not been accepted.".into(), ); + return; } if !data.dropped { offer.as_ref().post_error( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer that has not been dropped.".into(), ); + return; } if data.chosen_action.is_empty() { offer.as_ref().post_error( wl_data_offer::Error::InvalidFinish as u32, "Cannot finish a data offer with no valid action.".into(), ); + return; } (&mut *callback.borrow_mut())(ServerDndEvent::Finished); data.active = false; @@ -304,6 +308,7 @@ where wl_data_offer::Error::InvalidAction as u32, "Invalid preferred action.".into(), ); + return; } let possible_actions = metadata.dnd_action & dnd_actions; data.chosen_action = (&mut *action_choice.borrow_mut())(possible_actions, preferred_action);