Closed Jofagi closed 7 months ago
The crash occurs in wxImage::InitAlpha() when it tries to access M_IMGDATA->m_alpha
. The call is made in wxImageList::GetImageListBitmaps(), in particular:
wxImage img = bmp.ConvertToImage();
if ( !img.HasAlpha() )
img.InitAlpha(); <-- crash occurs in this function
That code in turn was called because there was no check for the supplied bitmap being valid.
This means that there are two parts needed for the fix. One is to add a check for a valid bitmap in wxImageList::GetImageListBitmap() and if that prevents the crash, then I can submit a PR to fix that in the wxWidgets code. The second part is for the Mockup code to verify that the art file is valid before trying to use it, and supply our standard question mark file if it isn't. That would prevent the crash in wxUiEditor, but there also needs to be a solution for code generation -- otherwise the generated code will still crash if an id is specified that doesn't exist at compile time.
Marking as high priority because of the crash.
Any fix should also be verified against the additional IDs available to Unix builds -- i.e., update one or more of the dialogs in the sdi project file (part of the wxUiTesting repository), then verify that it doesn't crash under Windows where the ids aren't available.
Starting with the Daily build on 1/2/2024, wxUiEditor should no longer crash, and instead will use a placeholder image.
I'm leaving the issue open because the wxWidgets side of the crash still needs to be fixed.
I've submitted a PR to wxWidgets to also prevent the crash, so combined with the fix in wxUiEditor I'm considering the issue resolved.
Description:
I'm trying out https://github.com/perazz/wxMaterialDesignArtProvider and therefore am using
wxART_
-IDs that wxUiEditor does not know about. Aside from not displaying the icons, this seems to mostly work with wxUiEditor, except for BookPage bitmaps.bitmap.type
to "Art"bitmap.id
to a value that isn't known to wxUiEditor's internal artprovider, e.g. "wxART_SETTINGS_APPLICATIONS|wxART_OTHER"I looked at the source: In gen_book_utils.cpp
AddBookImageList()
callsas_wxBitmapBundle()
and adds the result tobundle_list
. If I change the code topush_back()
only if the bundleIsOk()
, this results in shifted bitmaps in case there are multiple BookPages, so that's probably not a good fix. It would need a placeholder bundle or something like that...