Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calling libcec_close twice on drop #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2,21 +2,21 @@
#[macro_use]
extern crate derive_builder;

#[cfg(abi4)]

Check failure on line 5 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi4`
mod enums4;
#[cfg(abi4)]

Check failure on line 7 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi4`
pub use enums4::*;
#[cfg(abi5)]

Check failure on line 9 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi5`
mod enums5;
#[cfg(abi5)]

Check failure on line 11 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi5`
pub use crate::enums5::*;

#[cfg(abi6)]

Check failure on line 14 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi6`
mod enums6;

#[cfg(abi6)]

Check failure on line 17 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi6`
pub use crate::enums6::*;
#[cfg(all(not(abi4), not(abi5), not(abi6)))]

Check failure on line 19 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi4`

Check failure on line 19 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi5`

Check failure on line 19 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi6`
compile_error!("BUG: libcec abi not detected");

use log::{trace, warn};
Expand All @@ -28,13 +28,13 @@
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 @@ -1320,7 +1320,7 @@
return Err(CecConnectionResultError::AdapterOpenFailed);
}

#[cfg(abi4)]

Check failure on line 1323 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Lint

unexpected `cfg` condition name: `abi4`
let callback_ret = unsafe {
libcec_sys::libcec_enable_callbacks(
connection.1,
Expand All @@ -1347,7 +1347,6 @@
impl Drop for CecConnection {
fn drop(&mut self) {
unsafe {
libcec_close(self.1);
libcec_destroy(self.1);
}
}
Expand Down
Loading