rocksky 0.9.0 → 0.9.1
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/rocksky/remote.rb +16 -2
- data/lib/rocksky/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84425f844d397e7187168e44115168f310f5a48269da6b1f3efc424cbf9991aa
|
|
4
|
+
data.tar.gz: 89e6d0d11fd1f88ec4e80498251f1d1d24cc4e77587860b7c96b0508306a3817
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b48c2675d3ecedc52f6b2c7b70a728d927dd69a2564bfe16bc8b55101dfbf866e44b67957b1ad866c57819b0b66360aa637745a73c87238b0c769aa5b5b5e49a
|
|
7
|
+
data.tar.gz: bbc58f41ea90eda2c8878cde5e6c182a364a5d8de5f4056ab5e6baad5178c67756cf2f02da5343a2b1a679d83839c02b0c1787de64ec6119a42c979abc9a9e2a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
- Fix a segfault when tearing down a `RemotePlayer` / `RemoteController`.
|
|
6
|
+
`#close` freed the native handle while the `#listen` background thread was
|
|
7
|
+
still blocked inside `#next_command` / `#next_event` (a use-after-free). It now
|
|
8
|
+
stops the background task and **joins** the listen thread — so the poll has
|
|
9
|
+
returned — before freeing. `#next_command` / `#next_event` also no-op once the
|
|
10
|
+
handle is released.
|
|
11
|
+
|
|
3
12
|
## 0.3.0
|
|
4
13
|
|
|
5
14
|
- `feed.get_stories` now accepts optional `feed:` (at-uri) and `following:`
|
data/lib/rocksky/remote.rb
CHANGED
|
@@ -57,6 +57,8 @@ module Rocksky
|
|
|
57
57
|
# Block until the next controller command, returned as a symbol-keyed Hash
|
|
58
58
|
# (e.g. +{ action: "play" }+), or +nil+ once disconnected.
|
|
59
59
|
def next_command
|
|
60
|
+
return nil if @ptr.null?
|
|
61
|
+
|
|
60
62
|
cmd = Rocksky.unwrap(C.rocksky_remote_player_next_command(@ptr))
|
|
61
63
|
cmd && Rocksky.symbolize(cmd)
|
|
62
64
|
end
|
|
@@ -103,7 +105,12 @@ module Rocksky
|
|
|
103
105
|
def close
|
|
104
106
|
return if @ptr.null?
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
# Stop the background task so a blocked #next_command returns nil and the
|
|
109
|
+
# #listen loop exits, then WAIT for that thread to leave the native call
|
|
110
|
+
# before freeing — freeing the handle while a poll is in flight is a
|
|
111
|
+
# use-after-free (segfault).
|
|
112
|
+
C.rocksky_remote_player_disconnect(@ptr)
|
|
113
|
+
@thread&.join unless @thread == Thread.current
|
|
107
114
|
@thread = nil
|
|
108
115
|
C.rocksky_remote_player_free(@ptr)
|
|
109
116
|
@ptr = Fiddle::Pointer.new(0)
|
|
@@ -166,6 +173,8 @@ module Rocksky
|
|
|
166
173
|
# Block until the next update, returned as a symbol-keyed Hash (each carries a
|
|
167
174
|
# +:type+), or +nil+ once disconnected.
|
|
168
175
|
def next_event
|
|
176
|
+
return nil if @ptr.null?
|
|
177
|
+
|
|
169
178
|
ev = Rocksky.unwrap(C.rocksky_remote_controller_next_event(@ptr))
|
|
170
179
|
ev && Rocksky.symbolize(ev)
|
|
171
180
|
end
|
|
@@ -244,7 +253,12 @@ module Rocksky
|
|
|
244
253
|
def close
|
|
245
254
|
return if @ptr.null?
|
|
246
255
|
|
|
247
|
-
|
|
256
|
+
# Stop the background task so a blocked #next_event returns nil and the
|
|
257
|
+
# #listen loop exits, then WAIT for that thread to leave the native call
|
|
258
|
+
# before freeing — freeing the handle while a poll is in flight is a
|
|
259
|
+
# use-after-free (segfault).
|
|
260
|
+
C.rocksky_remote_controller_disconnect(@ptr)
|
|
261
|
+
@thread&.join unless @thread == Thread.current
|
|
248
262
|
@thread = nil
|
|
249
263
|
C.rocksky_remote_controller_free(@ptr)
|
|
250
264
|
@ptr = Fiddle::Pointer.new(0)
|
data/lib/rocksky/version.rb
CHANGED