forked from organicmaps/organicmaps
Android: SetMapStyle causes crash if GL context doesn't exist (old render policy does not exist)
This commit is contained in:
parent
cfaca17907
commit
df8efe4ed1
1 changed files with 17 additions and 7 deletions
|
@ -214,16 +214,26 @@ namespace android
|
|||
if (m_work.GetMapStyle() == mapStyle)
|
||||
return;
|
||||
|
||||
// drop old render policy
|
||||
m_work.SetRenderPolicy(nullptr);
|
||||
bool const hasRenderPolicy = (nullptr != m_work.GetRenderPolicy());
|
||||
|
||||
m_work.SetMapStyle(mapStyle);
|
||||
if (hasRenderPolicy)
|
||||
{
|
||||
// Drop old render policy.
|
||||
m_work.SetRenderPolicy(nullptr);
|
||||
|
||||
// construct new render policy
|
||||
if (!InitRenderPolicyImpl(m_densityDpi, m_screenWidth, m_screenHeight))
|
||||
return;
|
||||
m_work.SetMapStyle(mapStyle);
|
||||
|
||||
m_work.SetUpdatesEnabled(true);
|
||||
// Construct new render policy.
|
||||
if (!InitRenderPolicyImpl(m_densityDpi, m_screenWidth, m_screenHeight))
|
||||
return;
|
||||
|
||||
m_work.SetUpdatesEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just set the flag, a new render policy will be initialized with this flag.
|
||||
m_work.SetMapStyle(mapStyle);
|
||||
}
|
||||
}
|
||||
|
||||
Storage & Framework::Storage()
|
||||
|
|
Loading…
Add table
Reference in a new issue