From e0f1f3b4d1860143070d15501e19546680ed664a Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Tue, 27 Oct 2015 09:49:01 -0500 Subject: Move reloading of theme outside of the action thread Reloading the GUI while the GUI is running and rendering is very dangerous as we may be deleting GUI resources before or while we are trying to render those same items. This change will allow us to safely load new resources and delete the old ones. Fixed a double free situation that was causing a crash on every other theme reload. Clear parsed xml documents when we are done loading the theme instead of keeping them in memory for the life of the theme to help save a little memory. Store starting page so that if we request a reload, we can enter the theme at the same starting point, which may come in handy if we allow for language selection on alternate starting pages such as the decrypt prompt or the system read only prompt. Change-Id: I45a7e3fb3daeefac56d70f8d4936938eb1244b99 --- gui/pages.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'gui/pages.hpp') diff --git a/gui/pages.hpp b/gui/pages.hpp index 03fb0e5de..018c2cab2 100644 --- a/gui/pages.hpp +++ b/gui/pages.hpp @@ -78,11 +78,11 @@ protected: class PageSet { public: - PageSet(char* xmlFile); + PageSet(const char* xmlFile); virtual ~PageSet(); public: - int Load(ZipArchive* package); + int Load(ZipArchive* package, char* xmlFile); int CheckInclude(ZipArchive* package, xml_document<> *parentDoc); Page* FindPage(std::string name); @@ -109,14 +109,11 @@ protected: int LoadVariables(xml_node<>* vars); protected: - char* mXmlFile; - xml_document<> mDoc; ResourceManager* mResources; std::vector mPages; std::vector*> templates; Page* mCurrentPage; std::vector mOverlays; // Special case for popup dialogs and the lock screen - std::vector*> mIncludedDocs; }; class PageManager @@ -128,6 +125,8 @@ public: static PageSet* SelectPackage(std::string name); static int ReloadPackage(std::string name, std::string package); static void ReleasePackage(std::string name); + static int RunReload(); + static void RequestReload(); // Used for actions and pages static int ChangePage(std::string name); @@ -166,6 +165,8 @@ protected: static PageSet* mBaseSet; static MouseCursor *mMouseCursor; static HardwareKeyboard *mHardwareKeyboard; + static bool mReloadTheme; + static std::string mStartPage; }; #endif // _PAGES_HEADER_HPP -- cgit v1.2.3