[Git][wxwidgets/wxwidgets][master] 6 commits: Fix assertion failure in generic animation control

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Jun 16, 2026, 2:13:38 AM (10 days ago) Jun 16
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 71f1b8b8
    by Paul Cornett at 2026-06-15T21:41:10-07:00
    Fix assertion failure in generic animation control
    
    See #26598
    
  • ecb37e81
    by Paul Cornett at 2026-06-15T21:59:05-07:00
    Fix drawing of very large bitmaps with GTK3
    
    Creating a Cairo "similar image" surface seems to use a lot of memory for very large
    images, resulting in what is probably an out-of-memory condition. Using a plain
    image surface allows sizes up to the Cairo limit of 32767x32767 to be handled.
    See #25656
    
  • e69213ec
    by Paul Cornett at 2026-06-15T22:02:57-07:00
    Remove declaration for function which was removed
    
    Should have been part of
    bf386d99c0 (Simplify wxSplashScreen drawing code, 2026-05-15)
    
  • be1274d5
    by Paul Cornett at 2026-06-15T22:20:39-07:00
    Avoid some -Wcomma warnings
    
  • 05e49a59
    by Paul Cornett at 2026-06-15T22:29:59-07:00
    Remove execute permission from source file
    
  • eb44efae
    by Paul Cornett at 2026-06-15T22:37:00-07:00
    Avoid some -Wzero-as-null-pointer-constant warnings
    

10 changed files:

Changes:

  • include/wx/generic/splash.h
    ... ... @@ -79,7 +79,6 @@ public:
    79 79
         wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER);
    
    80 80
     
    
    81 81
         void OnPaint(wxPaintEvent& event);
    
    82
    -    void OnEraseBackground(wxEraseEvent& event);
    
    83 82
     
    
    84 83
         void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
    
    85 84
         wxBitmap& GetBitmap() { return m_bitmap; }
    

  • src/common/imagwebp.cpp

  • src/common/time.cpp
    ... ... @@ -157,16 +157,24 @@ int wxGetTimeZone()
    157 157
         // We must initialize the time zone information before using it. It's not a
    
    158 158
         // problem if we do it twice due to a race condition, as it's idempotent
    
    159 159
         // anyhow, so don't bother with any locks here.
    
    160
    -    static bool s_tzSet = (_tzset(), true);
    
    161
    -    wxUnusedVar(s_tzSet);
    
    160
    +    static bool s_tzSet;
    
    161
    +    if (!s_tzSet)
    
    162
    +    {
    
    163
    +        _tzset();
    
    164
    +        s_tzSet = true;
    
    165
    +    }
    
    162 166
     
    
    163 167
         long t;
    
    164 168
         _get_timezone(&t);
    
    165 169
         return t;
    
    166 170
     #else // Use some kind of time zone variable.
    
    167 171
         // In any case we must initialize the time zone before using it.
    
    168
    -    static bool s_tzSet = (tzset(), true);
    
    169
    -    wxUnusedVar(s_tzSet);
    
    172
    +    static bool s_tzSet;
    
    173
    +    if (!s_tzSet)
    
    174
    +    {
    
    175
    +        tzset();
    
    176
    +        s_tzSet = true;
    
    177
    +    }
    
    170 178
     
    
    171 179
         #if defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it.
    
    172 180
             return WX_TIMEZONE;
    

  • src/generic/animateg.cpp
    ... ... @@ -450,7 +450,7 @@ void wxGenericAnimationCtrl::DisplayStaticImage()
    450 450
         // m_bmpStaticReal will be updated only if necessary...
    
    451 451
         UpdateStaticImage();
    
    452 452
     
    
    453
    -    if (m_bmpStaticReal.IsOk())
    
    453
    +    if (m_bmpStaticReal.IsOk() && m_backingStore.IsOk())
    
    454 454
         {
    
    455 455
             // copy the inactive bitmap in the backing store
    
    456 456
             // eventually using the mask or the alpha if the static
    

  • src/gtk/bitmap.cpp
    ... ... @@ -1344,19 +1344,36 @@ void wxBitmap::SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg, c
    1344 1344
             return;
    
    1345 1345
         }
    
    1346 1346
     
    
    1347
    +    const GdkPixbuf* const pixbuf = bmpData->m_pixbufNoMask;
    
    1348
    +
    
    1347 1349
         // Silently ignore attempts to draw uninitialized bitmap,
    
    1348 1350
         // because other platforms don't complain about it
    
    1349
    -    if (bmpData->m_pixbufNoMask == nullptr)
    
    1351
    +    if (pixbuf == nullptr)
    
    1350 1352
             return;
    
    1351 1353
     
    
    1352 1354
         if (bmpData->m_bpp == 1)
    
    1353 1355
             SetSourceSurface1(bmpData, cr, x, y, fg, bg);
    
    1354
    -    else
    
    1356
    +    else if (size_t(bmpData->m_width) * bmpData->m_height < 3000 * 3000)
    
    1355 1357
         {
    
    1356
    -        gdk_cairo_set_source_pixbuf(cr, bmpData->m_pixbufNoMask, x, y);
    
    1358
    +        // This uses cairo_surface_create_similar_image(), which results in
    
    1359
    +        // a faster-drawing surface on X11, but requires more memory and
    
    1360
    +        // restricts the maximum size to considerably less than a
    
    1361
    +        // CAIRO_SURFACE_TYPE_IMAGE, so don't use it for very large sizes.
    
    1362
    +        gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y);
    
    1357 1363
             cairo_pattern_get_surface(cairo_get_source(cr), &bmpData->m_surface);
    
    1358 1364
             cairo_surface_reference(bmpData->m_surface);
    
    1359 1365
         }
    
    1366
    +    else
    
    1367
    +    {
    
    1368
    +        cairo_surface_t* surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1);
    
    1369
    +        cairo_t* cr2 = cairo_create(surf);
    
    1370
    +        cairo_surface_destroy(surf);
    
    1371
    +        gdk_cairo_set_source_pixbuf(cr2, pixbuf, 0, 0);
    
    1372
    +        cairo_pattern_get_surface(cairo_get_source(cr2), &bmpData->m_surface);
    
    1373
    +        cairo_surface_reference(bmpData->m_surface);
    
    1374
    +        cairo_destroy(cr2);
    
    1375
    +        cairo_set_source_surface(cr, bmpData->m_surface, x, y);
    
    1376
    +    }
    
    1360 1377
     }
    
    1361 1378
     
    
    1362 1379
     cairo_t* wxBitmap::CairoCreate() const
    

  • src/unix/glx11.cpp
    ... ... @@ -500,7 +500,7 @@ wxGLContextX11::wxGLContextX11(wxGLCanvas *win,
    500 500
         wxCHECK_RET(tempContext, "glXCreateContext failed" );
    
    501 501
     
    
    502 502
         GLXFBConfig* const fbc = winX11->GetGLXFBConfig();
    
    503
    -    PFNGLXCREATECONTEXTATTRIBSARBPROC wx_glXCreateContextAttribsARB = 0;
    
    503
    +    PFNGLXCREATECONTEXTATTRIBSARBPROC wx_glXCreateContextAttribsARB = nullptr;
    
    504 504
         if (fbc)
    
    505 505
         {
    
    506 506
             wx_glXCreateContextAttribsARB =
    

  • tests/archive/archivetest.cpp
    ... ... @@ -771,7 +771,8 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in)
    771 771
         if ((m_options & PipeIn) == 0)
    
    772 772
             OnArchiveExtracted(*arc, expectedTotal);
    
    773 773
     
    
    774
    -    while (entry = EntryPtr(arc->GetNextEntry()), entry.get() != nullptr) {
    
    774
    +    while ((entry = EntryPtr(arc->GetNextEntry())).get())
    
    775
    +    {
    
    775 776
             wxString name = entry->GetName(wxPATH_UNIX);
    
    776 777
     
    
    777 778
             // provide some context for the error message so that we know which
    

  • tests/controls/gridtest.cpp
    ... ... @@ -2199,7 +2199,7 @@ TEST_CASE_METHOD(GridTestCase,
    2199 2199
             int row, col, rows, cols;
    
    2200 2200
     
    
    2201 2201
             // Check main cell.
    
    2202
    -        row = multi.row,
    
    2202
    +        row = multi.row;
    
    2203 2203
             col = multi.col;
    
    2204 2204
             wxGrid::CellSpan span = m_grid->GetCellSize(row, col, &rows, &cols);
    
    2205 2205
     
    

  • tests/strings/numformatter.cpp
    ... ... @@ -562,7 +562,7 @@ TEST_CASE_METHOD(NumFormatterAlternateTestCase, "NumFormatterAlternateTestCase::
    562 562
     
    
    563 563
         WX_ASSERT_FAILS_WITH_ASSERT
    
    564 564
         (
    
    565
    -        wxNumberFormatter::FromString("123", static_cast<long *>(0))
    
    565
    +        wxNumberFormatter::FromString("123", static_cast<long*>(nullptr))
    
    566 566
         );
    
    567 567
     
    
    568 568
         long l;
    
    ... ... @@ -598,7 +598,7 @@ TEST_CASE_METHOD(NumFormatterAlternateTestCase, "NumFormatterAlternateTestCase::
    598 598
     
    
    599 599
         WX_ASSERT_FAILS_WITH_ASSERT
    
    600 600
         (
    
    601
    -        wxNumberFormatter::FromString("123", static_cast<wxLongLong_t *>(0))
    
    601
    +        wxNumberFormatter::FromString("123", static_cast<wxLongLong_t*>(nullptr))
    
    602 602
         );
    
    603 603
     
    
    604 604
         wxLongLong_t l;
    
    ... ... @@ -634,7 +634,7 @@ TEST_CASE_METHOD(NumFormatterAlternateTestCase, "NumFormatterAlternateTestCase::
    634 634
     
    
    635 635
         WX_ASSERT_FAILS_WITH_ASSERT
    
    636 636
         (
    
    637
    -        wxNumberFormatter::FromString("123", static_cast<double *>(0))
    
    637
    +        wxNumberFormatter::FromString("123", static_cast<double*>(nullptr))
    
    638 638
         );
    
    639 639
     
    
    640 640
         double d;
    

  • tests/test.cpp
    ... ... @@ -463,13 +463,13 @@ static bool DoCheckConnection()
    463 463
     
    
    464 464
         wxSocketClient sock;
    
    465 465
         sock.SetTimeout(10);    // 10 secs
    
    466
    -    bool online = sock.Connect(addr) &&
    
    467
    -                    (sock.Write(HTTP_GET, strlen(HTTP_GET)), sock.WaitForRead(1));
    
    468
    -
    
    469
    -    return online;
    
    470
    -#else
    
    471
    -    return false;
    
    466
    +    if (sock.Connect(addr))
    
    467
    +    {
    
    468
    +        sock.Write(HTTP_GET, strlen(HTTP_GET));
    
    469
    +        return sock.WaitForRead(1);
    
    470
    +    }
    
    472 471
     #endif
    
    472
    +    return false;
    
    473 473
     }
    
    474 474
     
    
    475 475
     extern bool IsNetworkAvailable()
    

Reply all
Reply to author
Forward
0 new messages