void Interface_GUIWindow::destroy(void* kodiBase, void* handle) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle); if (!addon || !pAddonWindow) { CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (handle='%p') on addon '%s'", __FUNCTION__, handle, addon ? addon->ID().c_str() : "unknown"); return; } Interface_GUIGeneral::lock(); CGUIWindow *pWindow = dynamic_cast<CGUIWindow*>(g_windowManager.GetWindow(pAddonWindow->GetID())); if (pWindow) { // first change to an existing window if (g_windowManager.GetActiveWindow() == pAddonWindow->GetID() && !g_application.m_bStop) { if(g_windowManager.GetWindow(pAddonWindow->m_oldWindowId)) g_windowManager.ActivateWindow(pAddonWindow->m_oldWindowId); else // old window does not exist anymore, switch to home g_windowManager.ActivateWindow(WINDOW_HOME); } // Free any window properties pAddonWindow->ClearProperties(); // free the window's resources and unload it (free all guicontrols) pAddonWindow->FreeResources(true); g_windowManager.Remove(pAddonWindow->GetID()); } delete pAddonWindow; Interface_GUIGeneral::unlock(); }
void Interface_GUIWindow::clear_properties(void* kodiBase, void* handle) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle); if (!addon || !pAddonWindow) { CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'", __FUNCTION__, addon, pAddonWindow, addon ? addon->ID().c_str() : "unknown"); return; } Interface_GUIGeneral::lock(); pAddonWindow->ClearProperties(); Interface_GUIGeneral::unlock(); }