RFR: 8235772: Remove use of deprecated finalize method from PiscesRenderer and AbstractSurface

Johan Vos jvos at openjdk.java.net
Sat Dec 21 18:22:55 UTC 2019


On Wed, 18 Dec 2019 16:55:30 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/native-prism-sw/JAbstractSurface.c line 63:
>> 
>>> 62:     }
>>> 63: }
>>> 64: 
>> 
>> there are no checks on memory errors as used to be in the finalize implementation. Are those not needed anymore?
> 
> Hi Johan,
> The `readAndClearMemErrorFlag()` method checks if the variable `mem_Error_Flag` is `JNI_TRUE`.
> A call should be made to `setMemErrorFlag()` to set `mem_Error_Flag` to `JNI_TRUE`.
> 
> The methods used to dispose Surface and renderer only `free()` the allocated memory and 
> do not result in making a call to `setMemErrorFlag().`
> So we do not need to check for `readAndClearMemErrorFlag()`
> And I think it was not required before this change too.

The dispose methods indeed won't set the `mem_Error_Flag` but this flag might have been set by other methods. Isn't there a probability that the flag has been set, and that `readAndClearMemErrorFlag()` is not yet called since the flag has been set?

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

PR: https://git.openjdk.java.net/jfx/pull/66


More information about the openjfx-dev mailing list