Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Jul 21, 2025

When an image is drawn on a GC, that image may be disposed right afterwards. Since the GC can live much longer and a handle for that GC at a different zoom may be requested later on, such that the operations in the GC are re-applied, the stored image may be disposed by then. This can currently lead to errors because of access to disposed resources.

To avoid that, this change ensures that in case a drawn image becomes disposed, a copy of it is created and stored for the lifetime of the GC.

⚠️ This depends on the GC operation disposal logic of and thus contains those changes and needs to be merged after #2328

@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2025

Test Results

   546 files  ±0     546 suites  ±0   34m 9s ⏱️ + 4m 3s
 4 412 tests +5   4 395 ✅ +5   17 💤 ±0  0 ❌ ±0 
16 718 runs  +5  16 591 ✅ +5  127 💤 ±0  0 ❌ ±0 

Results for commit 5f80f4d. ± Comparison against base commit 239428b.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the gc-image-copy-in-operations branch from 3bb6975 to 361e322 Compare July 21, 2025 17:10
@HeikoKlare HeikoKlare marked this pull request as ready for review July 21, 2025 17:26
@HeikoKlare HeikoKlare force-pushed the gc-image-copy-in-operations branch from 361e322 to 161a287 Compare July 22, 2025 08:43
@arunjose696
Copy link
Contributor

I have gone through the code, and it looks good. I also tested additional disposal scenarios for example, using multiple Image operations that refer to the same source Image which is then disposed. The fix works correctly in all cases I tested.

When an image is drawn on a GC, that image may be disposed right
afterwards. Since the GC can live much longer and a handle for that GC
at a different zoom may be requested later on, such that the operations
in the GC are re-applied, the stored image may be disposed by then. This
can currently lead to errors because of access to disposed resources.

To avoid that, this change ensures that in case a drawn image becomes
disposed, a copy of it is created and stored for the lifetime of the GC.
@HeikoKlare HeikoKlare force-pushed the gc-image-copy-in-operations branch from 161a287 to 5f80f4d Compare July 22, 2025 11:39
Copy link
Contributor

@amartya4256 amartya4256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Tests positively for both the cases:

  1. The copy of the image is set to the GC before disposing.
  2. On disposal on GC, no new copy of image is registered.

Approved.

@HeikoKlare HeikoKlare merged commit f0afb7f into eclipse-platform:master Jul 22, 2025
17 checks passed
@HeikoKlare HeikoKlare deleted the gc-image-copy-in-operations branch July 22, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken resource handling with operation pattern in GC

3 participants