From 02f7a5361dec17f2c70eb30d8f0779b7eaa7ae64 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Nov 2022 20:08:35 +0100 Subject: [PATCH] Fix wxImageList creation in wxGenericPrintSetupDialog Size must be provided when creating wxImageList, otherwise calling Add() on it fails later. --- src/generic/prntdlgg.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index 2792f55d55..391c27d181 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -487,8 +487,9 @@ void wxGenericPrintSetupDialog::Init(wxPrintData* data) m_printerListCtrl = new wxListCtrl( this, wxPRINTID_PRINTER, wxDefaultPosition, wxSize(wxDefaultCoord,100), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER ); - wxImageList *image_list = new wxImageList; - image_list->Add( wxBitmap(check_xpm) ); + wxBitmap checkBmp(check_xpm); + wxImageList *image_list = new wxImageList( checkBmp.GetWidth(), checkBmp.GetHeight() ) ; + image_list->Add( checkBmp ); m_printerListCtrl->AssignImageList( image_list, wxIMAGE_LIST_SMALL ); m_printerListCtrl->InsertColumn( 0, wxT(" "), wxLIST_FORMAT_LEFT, 20 );