On Wed, 28 Jan 2026 21:05:50 GMT, Phil Race <[email protected]> wrote:
>>> I am pretty sure this was AppContext related, since we could not return a >>> MediaTracker stored in one AppContext to another AppContext and now we are >>> doing exactly that, but ok not a big issue. >> >> Very much likely. >> >> Does an app need direct access to the `MediaTracker` that's used to download >> the image? Probably not, therefore a private member is better. >> >>> The only difference between the two is that the old MediaTracker component >>> was created using createComponent, which resets the AppContext, should we >>> drop that AppContext usage there as well? >> >> Indeed, the component created via `createComponent` doesn't store a >> reference to app context. >> >> https://github.com/prrace/jdk/blob/08f95226d2c638cae74f51836b7fc509ed5b0b8b/src/java.desktop/share/classes/javax/swing/ImageIcon.java#L116-L119 >> >> I guess it'll get removed when the `appContext` field gets removed from >> `Component`. >> >> On the other hand, the shared `MediaTracker` instance introduced in this PR >> could use `createComponent` to instead of creating a new instance of >> `Component`. > >> I am pretty sure this was AppContext related, since we could not return a >> MediaTracker stored in one AppContext to another AppContext and now we are >> doing exactly that, but ok not a big issue. >> > > Not a big issue because only tests create 2 ACs now and the tests and AC > itself will be removed as soon as I can get past these leaf issues. > > Going further back it still doesn't seem to be the case that it was an AC fix. > It was actually due to a security issue with ACC (AccessControlContext). > That fix is now no longer there because we removed SM code a couple of > releases ago. > Now we can simplify it even further. > > But it still doesn't seem like we need to resurrect using the visible field. > >> The only difference between the two is that the old MediaTracker component >> was created using createComponent, which resets the AppContext, should we >> drop that AppContext usage there as well? > > Yes, I don't know why I didn't do that. > Does an app need direct access to the `MediaTracker` that's used to download > the image? Probably not, therefore a private member is better. The application will have this access via getter already, the problematic part here is access to the Component which is mutable so we cannot use it via final field. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29433#discussion_r2738610762
