leptris 1.9.5 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 996051e28883434c5ac9cf2041278a37a0ebc3ad628685838e6b743cc87e0b9d
4
- data.tar.gz: 3909cce576ad3ce14fa65c4058997476ddd814ea9f819e00e0b4bbb969bd09cf
3
+ metadata.gz: 68bba6b5b68f0266571ec17a5809ea42ce7b1f37f0ba3577f9a06afd57db578f
4
+ data.tar.gz: d15442dd463ba2b4d09c6415e51c478c385c851eb6630ffc8c4d00e6a9ad7a57
5
5
  SHA512:
6
- metadata.gz: 61f73189528f9c0ffaff803328304baa44af1e545d6618d252ff8e46b5279a229fb204df807815a22a360bffbf107a0c32e1a33f5110cb699ae8135e06d2777e
7
- data.tar.gz: 4b5b197e569e23820b74b1596b3a8f8bf2feefba09af9858bb830cbcd6339d59c196e71177760ab35eb7daeac30bd5c3edb2b384d1ff43fc56726b838bfe0f0a
6
+ metadata.gz: 52a5f4a5307b9b219911a9ebb7050672be1ad27096266e1c0732eb98ab40779055dcf25e4dd31c0ef0813966539e43894c6d4cdce20bd79e778a7df043c5631a
7
+ data.tar.gz: cd2e0732f88060f6ff02e3496bedca3d986fde26c9400c91efe458c05e96379caeddd50a5950eb65b965be23487aac243ada697855ade71d0ed6017bcfe49433
data/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ All notable changes to Leptris will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.6] - 2026-08-26
9
+
10
+ ### Changed
11
+
12
+ - The lifetime guard (`ensure_alive!`) uses the cheapest sufficient
13
+ check (`Document#c_ptr.nil?` — `#free` nils it, and the GC
14
+ finalizer cannot fire while any handle exists) instead of the
15
+ deeper `Document#freed?` chain. Claw back on the cheapest single-
16
+ dispatch read (`Element#[]` hot loops): ~20% of the guard's cost.
17
+ Remaining guard cost is the method dispatch itself — the price of
18
+ the lifetime contract on the one call shape cheap enough to
19
+ notice it; all other harness loops measure at parity, and
20
+ readonly hot loops have the memoized `attributes`/`keys`
21
+ alternatives.
22
+
8
23
  ## [1.9.5] - 2026-08-26
9
24
 
10
25
  ### Fixed
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.5"
4
+ VERSION = "1.9.6"
5
5
  end
@@ -87,9 +87,14 @@ class Leptris::XML::Node
87
87
 
88
88
  # Borrowed-handle lifetime: every c_ptr dereference is valid only
89
89
  # while the owning document lives. Parentless nodes (iterparse
90
- # yields) cannot validate and are skipped.
90
+ # yields) cannot validate and are skipped. The guard runs before
91
+ # every uncached FFI dispatch, so it uses the cheapest sufficient
92
+ # check: #free nils the document's c_ptr, and the GC-finalizer
93
+ # path cannot fire while any handle (which strongly references
94
+ # the document) exists. Document#freed? remains the accurate
95
+ # public predicate.
91
96
  def ensure_alive!
92
- if @document&.freed?
97
+ if @document && @document.c_ptr.nil?
93
98
  raise Leptris::XML::UseAfterFreeError,
94
99
  "owning document has been freed — handle used on #{inspect}"
95
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.