Skip to content

Fix Converter::GetConversionChain() returning nullptr when normalization is configured - #1380

Merged
frankslin merged 1 commit into
BYVoid:masterfrom
frankslin:upstream-master
Jul 1, 2026
Merged

frankslin merged 1 commit into
BYVoid:masterfrom
frankslin:upstream-master

Conversation

@frankslin

Copy link
Copy Markdown
Collaborator

Introduce ConfigBasedConverter to correctly expose the main conversion chain when a normalization pre-pass is present, resolving a null-pointer crash in downstream consumers such as librime. Also bumps the CMake/Bazel fallback version to 1.4.0 and tightens the installed public header set.

NOTE: dev builds derived from untagged commits may still report package version 1.3.2.dev…; the SOVERSION is explicitly pinned to 1.4 by the preceding commit (#1377) and is unaffected by the git-tag-derived package version.

Detailed Changes:

  • ConfigBasedConverter (new private class):
    • Wraps normConverter + mainConverter; delegates GetConversionChain() to mainConverter so callers always receive a valid non-null ConversionChain.
    • Replaces PipelineConverter in Config.cpp when a normalization field is present.
  • Public header cleanup:
    • DictConverter.hpp, PhraseExtract.hpp, UTF8StringSlice.hpp moved from LIBOPENCC_HEADERS to LIBOPENCC_PRIVATE_HEADERS (CLI-tool internals, not library API).
    • BinaryDict.hpp, DartsDict.hpp likewise moved to private (were incorrectly appended to the public list).
  • Version fallback: cmake/GitVersion.cmake minor 3→4, revision 2→0; MODULE.bazel version 1.3.2→1.4.0.
  • Regression test: NormalizationGetConversionChainIsNonNull verifies GetConversionChain() is non-null and delegates to the main chain, not the normalization chain.

…ion is configured

Introduce ConfigBasedConverter to correctly expose the main conversion chain when a normalization pre-pass is present, resolving a null-pointer crash in downstream consumers such as librime. Also bumps the CMake/Bazel fallback version to 1.4.0 and tightens the installed public header set.

Note: dev builds derived from untagged commits may still report package version 1.3.2.dev…; the SOVERSION is explicitly pinned to 1.4 by the preceding commit (BYVoid#1377) and is unaffected by the git-tag-derived package version.

Detailed Changes:
- **ConfigBasedConverter** (new private class):
  - Wraps normConverter + mainConverter; delegates GetConversionChain() to mainConverter so callers always receive a valid non-null ConversionChain.
  - Replaces PipelineConverter in Config.cpp when a normalization field is present.
- **Public header cleanup**:
  - DictConverter.hpp, PhraseExtract.hpp, UTF8StringSlice.hpp moved from LIBOPENCC_HEADERS to LIBOPENCC_PRIVATE_HEADERS (CLI-tool internals, not library API).
  - BinaryDict.hpp, DartsDict.hpp likewise moved to private (were incorrectly appended to the public list).
- **Version fallback**: cmake/GitVersion.cmake minor 3→4, revision 2→0; MODULE.bazel version 1.3.2→1.4.0.
- **Regression test**: NormalizationGetConversionChainIsNonNull verifies GetConversionChain() is non-null and delegates to the main chain, not the normalization chain.
@frankslin

Copy link
Copy Markdown
Collaborator Author

cc @loafer-19 @lotem

@frankslin
frankslin merged commit ffddbe1 into BYVoid:master Jul 1, 2026
34 checks passed
@frankslin
frankslin deleted the upstream-master branch July 1, 2026 15:45
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.

1 participant