Skip to content

Unsubscribe ImageCropper's Application.Idle handler on Dispose - #1532

Merged
imnasnainaec merged 4 commits into
masterfrom
fix/image-cropper-idle-unsubscribe
Jul 17, 2026
Merged

Unsubscribe ImageCropper's Application.Idle handler on Dispose#1532
imnasnainaec merged 4 commits into
masterfrom
fix/image-cropper-idle-unsubscribe

Conversation

@imnasnainaec

@imnasnainaec imnasnainaec commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

ImageCropper subscribed to the static Application.Idle event in its constructor but never unsubscribed in Dispose, so the handler could still fire after the control was disposed.

Tests: Dispose_CalledTwiceAfterSettingImage_DoesNotThrow is a smoke test, and Dispose_AllowsGarbageCollection is a regression test that asserts the control is garbage-collected after disposal — it fails without the unsubscribe fix and passes with it.

Devin review: https://app.devin.ai/review/sillsdev/libpalaso/pull/1532/


This change is Reviewable

ImageCropper subscribed to the static Application.Idle event in its
constructor but never unsubscribed in Dispose, so the handler could still
fire after the control was disposed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@imnasnainaec imnasnainaec self-assigned this Jul 13, 2026
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Palaso Tests

     4 files  ±0       4 suites  ±0   11m 0s ⏱️ + 1m 0s
 5 107 tests +2   4 873 ✅ +1  234 💤 +1  0 ❌ ±0 
16 633 runs  +6  15 912 ✅ +3  721 💤 +3  0 ❌ ±0 

Results for commit 020c3b7. ± Comparison against base commit 2959cb9.

This pull request skips 1 test.
SIL.Tests.IO.FileLocationUtilitiesTests ‑ LocateInProgramFiles_SendValidProgramDeepSearch_ReturnsProgramPath

♻️ This comment has been updated with latest results.

@imnasnainaec
imnasnainaec marked this pull request as ready for review July 15, 2026 21:44
Comment thread SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.cs
The existing smoke test passed even without the fix. This test creates and
disposes an ImageCropper, then asserts the instance is garbage collected,
which only happens once Dispose unsubscribes from the static Application.Idle
event. Verified to fail on the un-fixed code and pass with the fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread SIL.Windows.Forms.Tests/ImageToolbox/ImageCropperTests.cs Dismissed
Comment thread SIL.Windows.Forms.Tests/ImageToolbox/ImageCropperTests.cs Dismissed
@imnasnainaec
imnasnainaec requested a review from hahn-kev July 16, 2026 14:38

@imnasnainaec imnasnainaec left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@imnasnainaec reviewed 3 files and all commit messages, made 1 comment, resolved 1 discussion, and dismissed @hahn-kev from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

Comment thread SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.cs
@imnasnainaec
imnasnainaec merged commit d10a05e into master Jul 17, 2026
11 checks passed
@imnasnainaec
imnasnainaec deleted the fix/image-cropper-idle-unsubscribe branch July 17, 2026 12:57
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.

3 participants