mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-30 13:58:31 +08:00
Creating wxAppTraits before the object of the user-defined class deriving from wxApp is fully constructed may result in creating a wrong traits object if the user class overrides CreateTraits() because the correct, i.e. user-defined, version isn't used if it's called from wx code. This had already happened before and was worked around back inbc334f39ec(Fixes Bug [ 930200 ] Async does not work, 2004-04-27), but recently happened again after the changes of94e4818caa(Warn on startup when not using comctl32.dll v6 in wxMSW, 2022-11-28). To prevent it from happening in the future, add WXAppConstructed() that must be called after fully constructing wxApp (and forgetting to do it would result in an assert, so doesn't risk to go unnoticed) and which resets m_traits if it has been wrongly created. It would, perhaps, be even better if we avoided creating the wrong traits in the first place, but for now this at least fixes the latest problem and ensures it doesn't reoccur. Closes #23315.