Skip to content

Fix findings from the development branch pre-merge review - #86

Open
pmeems wants to merge 2 commits into
developmentfrom
Improvements
Open

pmeems wants to merge 2 commits into
developmentfrom
Improvements

Conversation

@pmeems

@pmeems pmeems commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the 22 findings from the pre-merge review of development (review report
development-review-20261116-152310.html), except #22, which was invalid and
gets an explanatory comment only.

Branch topology (#4) - required before merge

main contains 8dfeba2, a squash of earlier development history. Its tree
equals development commit 7f12016, but because it is not an ancestor, a
trial merge reports conflicts in 29 files.

This branch records main as merged without content changes:

git diff 7f12016 origin/main      # must be empty
git merge -s ours origin/main

Use merge commits, not squash commits, for future development -> main
releases. The lesson is recorded in .ai/memory/lessons/lessons.md.

Changes

Core

  • Modern GDAL Integration for MapWinGIS6 #11 VectorDataset: discard the cached feature after every
    SetFeature. Drivers may coerce written values (the Shapefile driver
    truncates strings to the DBF field width), so later reads now return the
    stored value. New test:
    VectorLayerEditTest.ReadsBackTheStoredValueAfterTheDriverCoercesAWrite.
  • MapWinGIS6 ActiveX Control and Modern Rendering Architecture #12 VectorDataset::TryOpen: documentation now states that only the open
    probe is non-throwing; path conversion and GDAL initialization failures still
    throw. Behavior is unchanged because an existing test expects
    InvalidArgument for unconvertible paths.
  • Merge conflicts #21 GdalAlgorithmRunner destructor comment corrected: releasing the
    runner may close datasets, and that close runs without the shared GDAL lock.
  • Merge #22 (invalid) RECOMPUTE EXTENT ON <layer>: the Shapefile and GPKG
    drivers take the rest of the statement as the literal layer name, so quoting
    would break it. Added a comment explaining this.

Rendering

ActiveX

  • Keep GDAL diagnostics suppressed during feature ID scans #1 CompleteVectorLoad holds a shared_ptr to the load state instead of
    a reference into the map node. Host callbacks such as FireViewChange can
    re-enter Close or EndLoadVectorDataset and erase the entry.

  • First merge to main from development #2 Alternate-size draws (printing, metafiles, scaled draws) fit the live
    visible extent into the target size.

  • Modern GDAL Integration for MapWinGIS6 #5 DrainNotifications reserves the batch before clearing pending flags,
    so an allocation failure cannot drop notifications.

  • Modern GDAL Integration for MapWinGIS6 #6 Each dispatch message delivers one batch and then returns to the
    message loop. Notifications that arrive during delivery post their own wake.
    A wake consumed by a sink's nested message pump is re-posted, with the
    existing retry timer as fallback.
    Caveat: posted messages still outrank input and paint messages in Win32, so
    this bounds the work per message but does not guarantee input processing
    while an operation reports progress continuously.

  • Modern GDAL Integration for MapWinGIS6 #7 BSTRs copied from the argument SAFEARRAY are owned by RAII before
    UTF-8 conversion, so they no longer leak if the conversion throws.

  • MapWinGIS6 ActiveX Control and Modern Rendering Architecture #8 DispatchGdalNotifications and the draw callback also catch
    non-std::exception exceptions at the COM boundary.

  • Update build yaml #13 The rendering properties report IID_IMapWinGISControl2, the
    interface that declares them, as the IErrorInfo source.

  • MapWinGIS6 ActiveX Control and Modern Rendering Architecture #17 MapWinGISControlSetVectorPreparationHookForTesting is exported
    only when MWG_ACTIVEX_TEST_HOOKS is defined:

    • CMake option MWG_ENABLE_ACTIVEX_TEST_HOOKS, default MWG_BUILD_TESTS.
    • MSBuild property MwgEnableActiveXTestHooks, default true.

    Distribution builds must turn it off. Tests that need the hook skip
    when it is absent.

Tests, scripts and samples

Repository hygiene

Documentation and memory

  • docs/ARCHITECTURE.md: shared layer scenes, live-extent drawing.
  • docs/BUILDING.md: MwgEnableActiveXTestHooks switch.
  • docs/gdal-integration.md: one event batch per dispatch message.
  • .ai/memory: shared scenes, event batching, test hook gating, driver
    coercion, squash-merge lesson.

Open assumptions to confirm in CI:

  • The GeoPackage fixtures accept the degenerate and collection geometries the
    new scene tests write.
  • FireViewChange reaches the advise sink in the Close re-entry test.

- Share immutable layer geometry without copying, render polygonal collection members, and skip malformed parts. Reuse GDI buffers and fit print and scaled draws to the live visible extent.
- Deliver one GDAL notification batch per message, repost wakes consumed by nested pumps, and keep vector-load state alive through reentrant control closure. Match managed completions by operation ID and normalize null warnings.
- Invalidate cached features after writes so reads reflect values stored by the driver.
- Make ActiveX test exports optional, protect existing COM registrations during activation checks, and add regression tests and documentation.

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

The hash-mixing expression implicitly narrows a 64-bit value to 32-bit std::size_t on Win32, breaking the Core build with warnings treated as errors.

2 open issues
1 file not reviewed
  • .idea/.gitignore: Generated file
What changed in this PR

This PR addresses pre-merge review findings across MapWinGIS6’s Core engine, rendering pipeline, and ActiveX wrapper, with supporting tests, documentation, and build controls.

Changes:

  • Share immutable layer geometry, handle mixed and degenerate geometry, and invalidate cached features after writes.
  • Harden ActiveX callback lifetimes, notification dispatch, COM resource ownership, and alternate-size drawing.
  • Add regression coverage, gate test-only exports, and update samples, registration safeguards, and repository guidance.

Windows builds and tests were not run during this review.

File Description
tests/​MapWinGIS.Core.Tests/​VectorRenderSceneTests.cpp Tests collection members and degenerate exteriors.
tests/​MapWinGIS.Core.Tests/​VectorLayerTests.cpp Tests reads after driver-coerced writes.
tests/​MapWinGIS.Core.Tests/​TestData.h Defines the fixture field-width constant.
tests/​MapWinGIS.Core.Tests/​TestData.cpp Uses the shared field-width constant.
tests/​MapWinGIS.Core.Tests/​MapViewTests.cpp Tests shared scene ownership and lifetime.
tests/​MapWinGIS.Core.Tests/​MapRenderSceneTests.cpp Adapts assertions to shared layer scenes.
tests/​MapWinGIS.ActiveX.Tests/​Verify-ActiveXActivation.ps1 Derives protected registration keys from IDL GUIDs.
tests/​MapWinGIS.ActiveX.Tests/​VectorLayerRendererTests.cpp Adapts fixtures and tests null-scene handling.
tests/​MapWinGIS.ActiveX.Tests/​RenderingBaselineTests.cpp Adapts benchmarks to shared scenes.
tests/​MapWinGIS.ActiveX.Tests/​ActiveXActivationTests.cpp Adds re-entry, drawing, dispatch, and error-info coverage.
src/​MapWinGIS.Core/​src/​vector/​VectorDataset.cpp Invalidates written-feature cache; explains extent SQL syntax.
src/​MapWinGIS.Core/​src/​rendering/​VectorRenderScene.cpp Renders polygonal collection members and counts skipped parts.
src/​MapWinGIS.Core/​src/​rendering/​PolygonTriangulation.cpp Uses hash-based vertex deduplication.
src/​MapWinGIS.Core/​src/​rendering/​MapRenderScene.cpp Creates shared immutable layer scenes.
src/​MapWinGIS.Core/​src/​map/​MapView.cpp Accepts prepared scenes without copying geometry.
src/​MapWinGIS.Core/​src/​gdal/​GdalAlgorithmRunner.cpp Corrects destructor documentation only.
src/​MapWinGIS.Core/​include/​mapwingis/​vector/​VectorDataset.h Clarifies TryOpen exception behavior.
src/​MapWinGIS.Core/​include/​mapwingis/​rendering/​VectorRenderScene.h Exposes skipped-geometry counts and contracts.
src/​MapWinGIS.Core/​include/​mapwingis/​rendering/​MapRenderScene.h Changes layer geometry to shared ownership.
src/​MapWinGIS.Core/​include/​mapwingis/​map/​MapView.h Declares and documents shared prepared-scene support.
src/​MapWinGIS.ActiveX/​OpenGlVectorLayerRenderer.cpp Reads shared scenes and rejects null pointers.
src/​MapWinGIS.ActiveX/​MapWinGISControl.cpp Hardens load lifetimes, COM boundaries, and scaled drawing.
src/​MapWinGIS.ActiveX/​MapWinGIS.ActiveX.vcxproj Adds the MSBuild test-hook switch.
src/​MapWinGIS.ActiveX/​GdiVectorLayerRenderer.cpp Reuses polygon buffers and handles null scenes.
src/​MapWinGIS.ActiveX/​GdalOperationDispatcher.cpp Reserves notification storage before clearing pending flags.
src/​MapWinGIS.ActiveX/​GdalEventSource.h Tracks nested redispatch requests.
src/​MapWinGIS.ActiveX/​GdalEventSource.cpp Delivers one batch per message and reposts consumed wakes.
src/​MapWinGIS.ActiveX/​ComConversion.cpp Gives copied BSTR arguments automatic cleanup.
src/​MapWinGIS.ActiveX/​CMakeLists.txt Conditionally enables test-hook exports.
samples/​CSharp/​ActiveXTestHost/​GdalOperationClient.cs Uses matching completion IDs and normalizes null warnings.
docs/​gdal-integration.md Documents bounded notification batches.
docs/​BUILDING.md Documents distribution-time test-hook settings.
docs/​ARCHITECTURE.md Explains shared scenes and live-extent drawing.
CMakeLists.txt Adds the CMake test-hook option.
.idea/​.gitignore Ignores machine-specific project files.
.ai/​memory/​lessons/​lessons.md Records merge-history and driver-coercion lessons.
.ai/​memory/​architecture/​core-library.md Records shared scenes and skipped-geometry behavior.
.ai/​memory/​architecture/​activex.md Records drawing, dispatch, and test-hook behavior.

Review effort: Balanced

- Avoid Win32 narrowing in the point hash combiner.

- Synchronize nested dispatch coverage and disable timer fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pmeems
pmeems enabled auto-merge (squash) November 18, 2026 16: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.

2 participants