wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.75k stars 1.69k forks source link

Fix BCC5.5 crashes (intl.cpp) #4935

Closed wxtrac closed 2 years ago

wxtrac commented 23 years ago

Issue migrated from trac ticket # 4935

component: wxMSW | priority: normal

2001-02-25 21:13:11: anonymous created the issue


This took really a long time to find, mainly because it happens only when debugging is disabled, so no debugger support. I experienced crashes of programs compiled with BCC5.5 that are using wxLocale and intl.cpp when compiled with FINAL=1 (both library and program). It happened with both the internat sample and my own program. The problem that I discovered in intl.cpp was that a return value of a function StringAtOfs() is directly used as a return value of wxMsgCatalog::GetString(), without getting assigned to a variable. BCC5.5 doesn't like this, the original value (a pointer to a translated string) never reached the caller wxLocale::GetString(). The pointers that are eventually passed to wxGetTranslation() were invalid, and thus the program crashed. Putting a temporary variable into wxMsgCatalog::GetString() solves the problem. There is another fix for a BCC specific warning.

wxtrac commented 23 years ago

2001-02-25 21:13:14: nobody uploaded file intl1.patch (1.3 KiB)

patch file for intl.cpp

wxtrac commented 23 years ago

2001-02-26 11:12:02: @vadz commented


your patch was applied to the cvs sources, thank you for it!