Don't keep entries for XRC resources that failed to load in wxXmlResource.
Attempting to load a resource that couldn't be loaded resulted in wxXmlResource::Load() returning false for this and _all_the_subsequent_ calls to it because each call to Load() reattempted to reload all resources, including the one(s) that failed to load initially. Instead, try to load just the resource(s) that we should load right now and ignore all the other ones. Also, don't add entries for the one(s) that we fail to load. This fixes the unit test failures in the XRC test case which was affected by the test checking that XRC couldn't be loaded from garbage that ran before it. It also makes the code simpler by ensuring that wxXmlResourceDataRecords elements always have a valid wxXmlDocument associated with them. Also clean up the code: use wxScopedPtr instead of manually deleting pointers and reorganize #if checks to be easier to follow. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66219 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -299,6 +299,10 @@ protected:
|
||||
virtual void DoReportError(const wxString& xrcFile, const wxXmlNode *position,
|
||||
const wxString& message);
|
||||
|
||||
// Load the contents of a single file and returns its contents as a new
|
||||
// wxXmlDocument (which will be owned by caller) on success or NULL.
|
||||
wxXmlDocument *DoLoadFile(const wxString& file);
|
||||
|
||||
// Scans the resources list for unloaded files and loads them. Also reloads
|
||||
// files that have been modified since last loading.
|
||||
bool UpdateResources();
|
||||
|
Reference in New Issue
Block a user