KeyWorksRW / wxUiEditor

RAD tool used to create and maintain wxWidgets UI elements.
Apache License 2.0
63 stars 7 forks source link

Bug: artprov.h include is sometimes missing in generated cpp files #1367

Closed Jofagi closed 8 months ago

Jofagi commented 8 months ago

I noticed that sometimes the line #include <wx/artprov.h> of generated CPP files is missing.

I've got this issue for quite a while now but could not reliably reproduce it so far. I still can't, but now I looked at the source and maybe found the problem:

GenerateCppClass() clears the m_NeedArtProviderHeader flag, then starts a thread that runs ParseImageProperties() which sets that flag.

The flag gets used in Line 420 but the thread gets join()-ed only many lines later.

KeyWorksRW commented 8 months ago

BaseCodeGenerator::ParseImageProperties() is used to determine if a function needs to be generated in the src file for Embed, SVG. It has nothing to do with Art files, so setting it most certainingly doesn't belong in a threaded function.

A better choice would be BaseCodeGenerator::GatherGeneratorIncludes() since that is not threaded. That function already calls else if (iter.type() == type_image) so it should be fairly straightforward to set the flag there.

Thanks for tracking this down Jofagi -- because it was threaded, it would indeed show up rarely. I'll check in a fix tomorrow.

Randalphwa commented 8 months ago

The fix will appear in the 1/6 Daily build.