diff options
| author | Alexander Taylor <alex@vector35.com> | 2026-05-12 18:37:26 -0400 |
|---|---|---|
| committer | Alexander Taylor <alex@vector35.com> | 2026-05-13 13:36:54 -0400 |
| commit | 3021a6889ba7bd36ffd2dd2ce5000284c2d95318 (patch) | |
| tree | 10506ee80042e74469aade109dcc873f63dc679d /rust | |
| parent | 11dad7415c678917a0de3a9d861c9dc8802c0977 (diff) | |
Increment SESSION_COUNT when cloning a Session.
Fixes #8166.
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/headless.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/src/headless.rs b/rust/src/headless.rs index fce8fbe7..f37259fd 100644 --- a/rust/src/headless.rs +++ b/rust/src/headless.rs @@ -295,7 +295,7 @@ pub fn license_location() -> Option<LicenseLocation> { } /// Wrapper for [`init`] and [`shutdown`]. Instantiating this at the top of your script will initialize everything correctly and then clean itself up at exit as well. -#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Default, PartialEq, Eq, Hash)] pub struct Session { license_duration: Option<Duration>, } @@ -422,6 +422,15 @@ impl Session { } } +impl Clone for Session { + fn clone(&self) -> Self { + SESSION_COUNT.fetch_add(1, SeqCst); + Self { + license_duration: self.license_duration, + } + } +} + impl Drop for Session { fn drop(&mut self) { let previous_count = SESSION_COUNT.fetch_sub(1, SeqCst); |
