Skip to content

Make ActiveX GDAL operations robust - #78

Merged
pmeems merged 43 commits into
developmentfrom
fix/phase-5-activex-gdal-robustness
Nov 15, 2026
Merged

pmeems merged 43 commits into
developmentfrom
fix/phase-5-activex-gdal-robustness

Conversation

@Julian-MW

Copy link
Copy Markdown

Summary

Implements phase 5 of the development review fix plan.

  • Marshal GDAL diagnostics lossily, replacing malformed UTF-8 and embedded NUL bytes with U+FFFD. Release completed operation slots before allocating COM result values so conversion failures cannot consume dispatcher capacity.
  • Convert native exception messages from the active Windows code page to UTF-8 before storing them in operation snapshots.
  • Catch exceptions at the EndGdalOperation COM boundary and return distinct HRESULTs with useful IErrorInfo. Add error information to failing ActiveX automation calls.
  • Make the dispatch retry timer owner-thread-only and active only while operation slots remain outstanding; stop it when the last slot is ended.
  • Resume event dispatch after window recreation and allow a control closed through IOleObject::Close to accept GDAL operations again after reactivation.
  • Add conversion, dispatcher-restart, timer-lifetime, and COM error-info tests; update architecture and testing documentation.

Validation

  • Not built or tested locally, as requested.
  • Added/updated GoogleTest coverage, but it remains unexecuted pending CI.
  • The phase checklist remains unchecked until the plan's build and test completion criteria are verified.

@pmeems
pmeems enabled auto-merge (squash) November 14, 2026 22:06
Route retry-timer updates through helpers so StartRetryTimer results are not discarded (C4834), make GdalDispatchWindow.h include atlbase.h, fix escaped newlines in debug output, and record phase 5 results and a lesson.

Co-authored-by: Junie <junie@jetbrains.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Reactivation can let stale operation IDs and callbacks affect new work, while unguarded allocations in exception handlers can terminate the COM host instead of reporting failure.

4 open issues
What changed in this PR

This PR hardens GDAL operations in MapWinGIS6’s ActiveX wrapper, focusing on diagnostic conversion, COM error reporting, and operation lifecycle management while keeping GDAL execution in Core.

Changes:

  • Adds lossy diagnostic conversion and releases completed operation slots before allocating COM results.
  • Adds error information to failing automation calls, restart support after Close, and operation-scoped retry timers.
  • Extends conversion, restart, timer, and error-info tests; updates documentation and phase tracking.

Builds and tests were not run during this review.

File Description
tests/​MapWinGIS.ActiveX.Tests/​GdalOperationDispatcherTests.cpp Adds dispatcher restart and retry-timer tests.
tests/​MapWinGIS.ActiveX.Tests/​ComConversionTests.cpp Tests malformed diagnostic text conversion.
tests/​MapWinGIS.ActiveX.Tests/​ActiveXActivationTests.cpp Adds COM error-description checks.
src/​MapWinGIS.ActiveX/​MapWinGISControl.h Declares window-creation and client-site hooks.
src/​MapWinGIS.ActiveX/​MapWinGISControl.cpp Updates result consumption, error reporting, and reactivation.
src/​MapWinGIS.ActiveX/​GdalOperationDispatcher.h Declares restart and outstanding-operation queries.
src/​MapWinGIS.ActiveX/​GdalOperationDispatcher.cpp Adds state replacement and native exception-message conversion.
src/​MapWinGIS.ActiveX/​GdalEventSource.h Declares reactivation and timer-management helpers.
src/​MapWinGIS.ActiveX/​GdalEventSource.cpp Connects event delivery, reactivation, and timer lifetime.
src/​MapWinGIS.ActiveX/​GdalDispatchWindow.h Adds explicit retry-timer controls and a self-contained ATL include.
src/​MapWinGIS.ActiveX/​ComConversion.h Declares lossy diagnostic conversion helpers.
src/​MapWinGIS.ActiveX/​ComConversion.cpp Implements diagnostic BSTR and array conversion.
docs/​TESTING.md Documents diagnostic conversion coverage.
docs/​ARCHITECTURE.md Describes operation lifetimes, reactivation, and retry timers.
.github/​plans/​development-review-fix-plan-20261113.md Records phase completion and validation notes.
.ai/​memory/​lessons/​lessons.md Documents the ATL header include-order requirement.

Review effort: Balanced

pmeems commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Resolved all four review comments. The fixes add generation-scoped event dispatch to prevent stale callbacks after reactivation, make worker exception diagnostics best-effort so allocation failures cannot escape the noexcept worker, preserve operation IDs across dispatcher restarts (with regression coverage for stale-ID lookup/cancellation), and report CoreInitialized errors using IID_IMapWinGISControl. I replied individually in each review thread. GitHub Actions build workflow has started for the latest PR head; validation is pending.

@pmeems
pmeems merged commit 77f7404 into development Nov 15, 2026
6 checks passed
@pmeems
pmeems deleted the fix/phase-5-activex-gdal-robustness branch November 15, 2026 00:54
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