SWTException: Widget is disposed in NewSerialFlashTargetWizardPage during background chip detection#1449
Conversation
📝 WalkthroughWalkthroughA reusable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java (1)
493-527: Please add SWTBot regression coverage for this wizard flow.This is a UI/workflow change in async port detection; add or extend a SWTBot test (Given-When-Then) that covers port selection plus page disposal while detection is running.
Based on learnings: Add or extend SWTBot tests in com.espressif.idf.ui.test following Given-When-Then structure when changing UI/workflows/wizards.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java` around lines 493 - 527, Add a SWTBot regression test in the com.espressif.idf.ui.test suite that exercises the async port-detection wizard flow in NewSerialFlashTargetWizardPage: simulate triggering espToolCommands.chipInformation for a serial port, verify appendToInfoArea progress output and that extractChipFromChipInfoOutput result is handled (TargetPortFoundMessage/TargetPortNotFoundMessage), and include a Given-When-Then case that disposes the wizard page while detection is running to assert no UI hang or exceptions; use SWTBot to open the wizard, select a port, start detection, dispose the page mid-detection, and assert expected UI state and absence of errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java`:
- Around line 493-527: Add a SWTBot regression test in the
com.espressif.idf.ui.test suite that exercises the async port-detection wizard
flow in NewSerialFlashTargetWizardPage: simulate triggering
espToolCommands.chipInformation for a serial port, verify appendToInfoArea
progress output and that extractChipFromChipInfoOutput result is handled
(TargetPortFoundMessage/TargetPortNotFoundMessage), and include a
Given-When-Then case that disposes the wizard page while detection is running to
assert no UI hang or exceptions; use SWTBot to open the wizard, select a port,
start detection, dispose the page mid-detection, and assert expected UI state
and absence of errors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5819884b-359e-4814-aff2-da42a618b284
📒 Files selected for processing (1)
bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java
|
Was there any functionality issue without this while making changes to the launch target and selecting the port? |
Hi Kondal, thanks for the review. I don’t think there are any functional issues with this (at least none that I’m aware of). However, the exception makes the logs harder to read, so I decided to fix it. |
Description
Created a method appendToInfoArea that checks whether the widget is disposed before using it.
Fixes # (IEP-1757)
Type of change
Please delete options that are not relevant.
How has this been tested?
Edit the launch target and select the port. While information is being appended to the widget, close the dialog or click Apply. Then check the log — there should be no SWT “widget is disposed” exception.
Test Configuration:
Dependent components impacted by this PR:
Checklist
Summary by CodeRabbit