Skip to content

Commit

Permalink
Fix calling libcec_close twice on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
kira-bruneau committed Sep 12, 2024
1 parent 2ada364 commit d388928
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Fix calling libcec_close twice on drop

## 7.1.1

- Require libcec >= 4.0.3 for fixed windows compatibility
Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ use libcec_sys::{
cec_command, cec_datapacket, cec_device_type_list, cec_keypress, cec_log_message,
cec_logical_address, cec_logical_addresses, cec_power_status, libcec_audio_get_status,
libcec_audio_mute, libcec_audio_toggle_mute, libcec_audio_unmute, libcec_clear_configuration,
libcec_close, libcec_configuration, libcec_connection_t, libcec_destroy,
libcec_get_active_source, libcec_get_device_power_status, libcec_get_logical_addresses,
libcec_initialise, libcec_is_active_source, libcec_mute_audio, libcec_open,
libcec_power_on_devices, libcec_send_key_release, libcec_send_keypress,
libcec_set_active_source, libcec_set_inactive_view, libcec_set_logical_address,
libcec_standby_devices, libcec_switch_monitoring, libcec_transmit, libcec_volume_down,
libcec_volume_up, ICECCallbacks, LIBCEC_OSD_NAME_SIZE, LIBCEC_VERSION_CURRENT,
libcec_configuration, libcec_connection_t, libcec_destroy, libcec_get_active_source,
libcec_get_device_power_status, libcec_get_logical_addresses, libcec_initialise,
libcec_is_active_source, libcec_mute_audio, libcec_open, libcec_power_on_devices,
libcec_send_key_release, libcec_send_keypress, libcec_set_active_source,
libcec_set_inactive_view, libcec_set_logical_address, libcec_standby_devices,
libcec_switch_monitoring, libcec_transmit, libcec_volume_down, libcec_volume_up, ICECCallbacks,
LIBCEC_OSD_NAME_SIZE, LIBCEC_VERSION_CURRENT,
};

use num_traits::ToPrimitive;
Expand Down Expand Up @@ -1347,7 +1347,6 @@ impl CecConnectionCfg {
impl Drop for CecConnection {
fn drop(&mut self) {
unsafe {
libcec_close(self.1);
libcec_destroy(self.1);
}
}
Expand Down

0 comments on commit d388928

Please sign in to comment.