Commit c98a149
Fix reusing a *Tokenizer after an empty stream has been closed
When parsing an empty reader, Stream.head does not get allocated by the pool
at any time and holds a pointer to undefToken.
Previously, on Stream.Close() it was released to the pool, which added the
pointer to undefToken to the pool. As the next call to ParseStream() has to
allocate a new token for the first keyword, it got it from the pool and
received the last released token, which was the pointer to undefToken.
Finally when Stream.IsValid() checked if Stream.head == undefToken, this
evaluated to true, and returned false.
Now, to make sure that we never release a pointer to undefToken into the pool,
we add a check for this in Stream.Close().
Closes: #301 parent 3c29bb0 commit c98a149
2 files changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
289 | 312 | | |
290 | 313 | | |
291 | 314 | | |
| |||
0 commit comments