flyingsaucerproject / flyingsaucer

XML/XHTML and CSS 2.1 renderer in pure Java
Other
1.98k stars 556 forks source link

Guard against race condition #170

Closed ghost closed 1 year ago

ghost commented 4 years ago

Assign styleMap to local method variable (localMap) to avoid possibility of styleMap becoming null during method execution, otherwise resulting in an NPE.

ghost commented 3 years ago

@pbrant -- could we get this one merged?

ghost commented 1 year ago

@pbrant -- bump?

pbrant commented 1 year ago

I think this will only be relevant if using SharedContext concurrently across multiple threads. Does that sound right given given your use of it?

This isn't how the code was intended to be used and it wouldn't surprise me if there are other issues with doing so. It can be used repeatedly (after calling .reset()) across a single thread though.

That said, the patch as written shouldn't cause any issues either so I'm fine with it.

ghost commented 1 year ago

I don't recall the exact circumstances around when I encountered the NPE, sorry. Merging would be great, because then I could get replace my custom build with the one from this repo.

pbrant commented 1 year ago

OK, sounds good.

pbrant commented 1 year ago

Released 9.2.1