1
0
forked from cheng/wallet

Discovered that modifying the wxWidgets manifest has no effect

Restored the wallet manifest.
Discovered that local wxString variables are apt to get wiped during
a throw.  Dangerous to pass a wXstring.utf8() to an exception
This commit is contained in:
Cheng 2023-09-25 10:23:11 +10:00
parent 883bd8ebe8
commit fefb99bb33
No known key found for this signature in database
GPG Key ID: 571C3A9C3B9E6FCA
3 changed files with 15 additions and 12 deletions

View File

@ -80,13 +80,14 @@
<AdditionalDependencies>mpir.lib;mpirxx.lib;libsodium.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>mpir.lib;mpirxx.lib;libsodium.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<Manifest> <Manifest>
<AdditionalManifestFiles>wallet.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles> <AdditionalManifestFiles>
</AdditionalManifestFiles>
</Manifest> </Manifest>
<Manifest> <Manifest>
<GenerateCategoryTags>false</GenerateCategoryTags> <GenerateCategoryTags>true</GenerateCategoryTags>
</Manifest> </Manifest>
<Manifest> <Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness> <EnableDpiAwareness>false</EnableDpiAwareness>
</Manifest> </Manifest>
<ResourceCompile /> <ResourceCompile />
<CustomBuildStep /> <CustomBuildStep />
@ -123,6 +124,9 @@
<CustomBuildStep /> <CustomBuildStep />
<CustomBuildStep /> <CustomBuildStep />
<CustomBuildStep /> <CustomBuildStep />
<Manifest>
<GenerateCategoryTags>true</GenerateCategoryTags>
</Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="../src/app.h" /> <ClInclude Include="../src/app.h" />

View File

@ -25,7 +25,7 @@ void sqlite3_init() {
errorCode = 7; errorCode = 7;
szError = "Fatal Error: Sqlite library did not init."; szError = "Fatal Error: Sqlite library did not init.";
// Cannot log the error, because logging not set up yet, so logging itself causes an exception // Cannot log the error, because logging not set up yet, so logging itself causes an exception
throw FatalException(szError.c_str()); throw FatalException(szError);
} }
} }

View File

@ -264,27 +264,26 @@ static bool checkDataConversionsProduceExpected(void){
} }
static bool CheckForUtfEnvironment(void) { static bool CheckForUtfEnvironment(void) {
ILogMessage("\tChecking for UTF locale."); ILogMessage("\tChecking for UTF locale.");
try { try {
bool utfEnvironment{ true }; bool utfEnvironment{ true };
wxString utfError{ wxT("") };
if constexpr (b_WINDOWS) { if constexpr (b_WINDOWS) {
auto ACP{ GetACP() }; auto ACP{ GetACP() };
// Check that windows thinks this is UTF8 // Check that windows thinks this is UTF8
utfEnvironment = utfEnvironment && (ACP == 65001); utfEnvironment = utfEnvironment && (ACP == 65001);
if (!utfEnvironment) { if (!utfEnvironment) {
utfError += wxString::Format(wxT("current code page %d—should be 65001☹, "), ACP); szError = std::format("current code page {}, —should be 65001☹, ", ACP);
} }
} }
auto FontEncoding{ wxLocale::GetSystemEncoding() }; auto FontEncoding{ wxLocale::GetSystemEncoding() };
// check that wxWidgets thinks this is UTF8 // check that wxWidgets thinks this is UTF8
utfEnvironment = utfEnvironment && (FontEncoding == wxFONTENCODING_UTF8); utfEnvironment = utfEnvironment && (FontEncoding == wxFONTENCODING_UTF8);
if (!utfEnvironment) { if (!utfEnvironment) {
utfError = wxString::Format(wxT("%swxFontEncoding %d—should be %d☹"), szError += std::format("swxFontEncoding {}, should be {} ☹",
utfError, (int)FontEncoding,
FontEncoding, (int)wxFONTENCODING_UTF8
wxFONTENCODING_UTF8); );
throw MyException(utfError.c_str(), __LINE__, __func__, SrcFilename); throw MyException(szError, __LINE__, __func__, SrcFilename);
} }
} }
catch (const MyException& e) { catch (const MyException& e) {