User forums > Help

Building C::B on Arch Linux - assert "image.IsOk()" failed in wxBitmap()

<< < (2/2)

Huki:
Below is cbLoadBitmap() from sdk/globals.cpp:

--- Code: ---wxBitmap cbLoadBitmap(const wxString& filename, wxBitmapType bitmapType)
{
    // cache this, can't change while we 're running :)
    static bool oldCommonControls = !UsesCommonControls6();

    wxImage im;
    wxFileSystem* fs = new wxFileSystem;
    wxFSFile* f = fs->OpenFile(filename);
    if (f)
    {
        wxInputStream* is = f->GetStream();
        im.LoadFile(*is, bitmapType);
        delete f;
    }
    delete fs;
    if (oldCommonControls && im.HasAlpha())
        im.ConvertAlphaToMask();

    return wxBitmap(im);
}

--- End code ---

When the bug happens, the call fs->OpenFile(filename) returns NULL. This means the empty wxImage im is passed as-is to wxBitmap(im). This triggers all those wxBitmap asserts.

There is something wrong with the way wxFileSystem::OpenFile() tries to resolve relative file paths. When I manually prepend my current working directory to filename, the call always succeeds. It's relative paths that behave oddly.

Again, there is no such problem when CB is build using configure / make.

oBFusCATed:
You can build a debug version of your wxgtk and try to debug it. It doesn't happen with my version in gentoo...

Navigation

[0] Message Index

[*] Previous page

Go to full version