On Wed, 23 Aug 2023 14:57:31 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   DisposerRecord leak fix
>
> modules/javafx.swing/src/main/java/javafx/embed/swing/SwingNode.java line 368:
> 
>> 366:     private void setContentImpl(JComponent content) {
>> 367:         if (lwFrame != null) {
>> 368:             rec.dispose();
> 
> is it possible for `rec` to be null at this point?
> would it make sense to rewrite this code block as
> 
> if(rec != null) {
>   rec.dispose();
>   rec = null;
> }
> if(disposeRecRef != null) {
>   Disposer.removeRecord(...)
>   disposerRecRef = null;
> }
> if(lwFrame != null) {
>  lsFrame = null;
> }
> 
> ?

If `lwFrame` is not null, little chance of `rec` to be null at this point as 
unlike PR#1178 there's no multiple threads involved, only EDT, so no race 
condition causing class variables to null out, 
but anyways I have added null check to be safe..

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1219#discussion_r1303735328

Reply via email to