One of the reasons why SDL is crashing on start is related to lazy initialization of the HMI/Mobile/v4
API classes. These classes are initialized on demand when some of threads are trying to get the object of that class first time. Most likely, at SDL start might be a situation when HMI/Mobile/v4 API classes are
constructing in the one thread and at that moment another thread is trying to get access to the inner data of not-yet-fully-constructed object and this causes a core crash with ~ISchemaItem() calls in stack trace. That is possible because access to these factories is not synchronized.
To avoid such situation, factory creation was moved to AM ctor and all other sub components just use getters when they need to get access to API instances.
Fixes #3163
This PR is ready for review.
Risk
This PR makes no API changes.
Summary
One of the reasons why SDL is crashing on start is related to lazy initialization of the HMI/Mobile/v4 API classes. These classes are initialized on demand when some of threads are trying to get the object of that class first time. Most likely, at SDL start might be a situation when HMI/Mobile/v4 API classes are constructing in the one thread and at that moment another thread is trying to get access to the inner data of not-yet-fully-constructed object and this causes a core crash with ~ISchemaItem() calls in stack trace. That is possible because access to these factories is not synchronized.
To avoid such situation, factory creation was moved to AM ctor and all other sub components just use getters when they need to get access to API instances.
CLA