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: SAX::ParserContext keeps a reference to the input #3395

Merged
merged 1 commit into from
Dec 29, 2024

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

I saw a failure in CI at https://github.com/sparklemotion/nokogiri/actions/runs/12529532790/job/34945362057?pr=3393

  1) Error:
Nokogiri::HTML4::SAX::ParserContext::constructor::encoding::.io#test_0001_supports passing encoding name:
NotImplementedError: method `read' called on terminated object (0x0000005520809790)
    test/html4/sax/test_parser_context.rb:60:in `parse_with'
    test/html4/sax/test_parser_context.rb:60:in `block (5 levels) in <module:SAX>'

So now the class keeps a reference to the input object to prevent it from being GCed before we parse it.

Have you included adequate test coverage?

Yes.

Does this change affect the behavior of either the C or the Java implementations?

N/A

to prevent it from being GCed before we parse it.
@flavorjones flavorjones added this to the v1.18.x patch releases milestone Dec 29, 2024
@flavorjones flavorjones added the topic/memory Segfaults, memory leaks, valgrind testing, etc. label Dec 29, 2024
@flavorjones flavorjones merged commit 82ffa0c into main Dec 29, 2024
145 checks passed
@flavorjones flavorjones deleted the flavorjones-fix-parser-context-references branch December 29, 2024 13:58
flavorjones added a commit that referenced this pull request Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/memory Segfaults, memory leaks, valgrind testing, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant