wxQt crashing loading SVG and adding it to the toolbar (Issue #24726)

22 views
Skip to first unread message

oneeyeman1

unread,
Jul 24, 2024, 12:22:40 AMJul 24
to wx-...@googlegroups.com, Subscribed

Description

Platform and version information

Bug description:

I experience the crash on wxQT, where both GTK and MSW worked just fine.

Expected vs observed behaviour:

I expect the progrm to at least not to crash

Stack trace:

Backtrace:
Thread 1 "dbhandler" received signal SIGSEGV, Segmentation fault.
0x00007ffff6db6e00 in QPixmap::isNull() const () from /usr/lib64/libQt5Gui.so.5
(gdb) bt
#0 0x00007ffff6db6e00 in QPixmap::isNull() const () from
/usr/lib64/libQt5Gui.so.5
#1 0x00007ffff6dc4e3c in QIcon::addPixmap(QPixmap const&,
QIcon::Mode, QIcon::State) () from /usr/lib64/libQt5Gui.so.5
#2 0x00007ffff5103ce2 in wxToolBarTool::SetIcon (this=0x555555a50d70)
at ../src/qt/toolbar.cpp:119
#3 0x00007ffff51049ad in wxToolBar::DoInsertTool
(this=0x555555bb4170, pos=5, toolBase=0x555555a50d70) at
../src/qt/toolbar.cpp:296
#4 0x00007ffff5250184 in wxToolBarBase::InsertTool
(this=0x555555bb4170, pos=5, tool=0x555555a50d70) at
../src/common/tbarbase.cpp:201
#5 0x00007ffff5252fff in wxToolBarBase::DoInsertNewTool
(this=0x555555bb4170, pos=5, tool=0x555555a50d70) at
../include/wx/tbarbase.h:679
#6 0x00007ffff5250073 in wxToolBarBase::InsertTool
(this=0x555555bb4170, pos=5, toolid=6, label=..., bitmap=...,
bmpDisabled=..., kind=wxITEM_NORMAL, shortHelp=...,
longHelp=..., clientData=0x0) at ../src/common/tbarbase.cpp:186
#7 0x00007ffff524ff6d in wxToolBarBase::DoAddTool
(this=0x555555bb4170, toolid=6, label=..., bitmap=...,
bmpDisabled=..., kind=wxITEM_NORMAL, shortHelp=...,
longHelp=..., clientData=0x0) at ../src/common/tbarbase.cpp:169
#8 0x0000555555582717 in wxToolBarBase::AddTool (this=0x555555bb4170,
toolid=6, label=..., bitmap=..., bmpDisabled=..., kind=wxITEM_NORMAL,
shortHelp=...,
longHelp=..., clientData=0x0) at /usr/local/include/wx-3.2/wx/tbarbase.h:306
#9 0x000055555557c59c in MainFrame::InitToolBar (this=0x55555572c410,
toolBar=0x555555bb4170) at ../../dbhandler/mainframe.cpp:375
#10 0x00005555555792cc in MainFrame::MainFrame (this=0x55555572c410,
manager=0x55555572bdc0) at ../../dbhandler/mainframe.cpp:213
#11 0x0000555555571b10 in MyApp::OnInit (this=0x5555556219b0) at
../../dbhandler/docview.cpp:130
#12 0x0000555555574327 in wxAppConsoleBase::CallOnInit
(this=0x5555556219b0) at /usr/local/include/wx-3.2/wx/app.h:93
#13 0x00007ffff4ad44b4 in wxEntry (argc=@0x7ffff4c9b724: 1,
argv=0x555555625fc0) at ../src/common/init.cpp:481
#14 0x00007ffff4ad45be in wxEntry (argc=@0x7fffffffdbfc: 1,
argv=0x7fffffffdcf8) at ../src/common/init.cpp:509
#15 0x00005555555712b8 in main (argc=1, argv=0x7fffffffdcf8) at
../../dbhandler/docview.cpp:71
(gdb)

Patch or snippet allowing to reproduce the problem:

toolBar->AddTool( wxID_LIBRARY, _( "Library" ), wxBitmapBundle::FromSVG( "library", wxSize( 16, 16 ) ), wxBitmapBundle::FromSVG( "library", wxSize( 16, 16 ) ), wxITEM_NORMAL, _( "Library selector" ) );

To Reproduce:

Steps to reproduce the behaviour, please make them as detailed as possible.
For example:

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error
  • wxWidgets version you use:
  • wxWidgets port you use:
  • OS and its version:
    • GTK version:
    • Which GDK backend is used:
    • Desktop environment :
    • Current theme:

THe library.h file is as follows:

static const char library[] =
R"xxx(

Svg Vector Icons : http://www.onlinewebfonts.com/icon )xxx";


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24726@github.com>

oneeyeman1

unread,
Jul 24, 2024, 9:10:07 PMJul 24
to wx-...@googlegroups.com, Subscribed

I fixed my code and the crash is gone now.

However, the GTK port is not crashing, but just doesn't render the icon/tool.

So, I'll leave it up to core devs to close it.

The proper code is:

toolBar->AddTool( wxID_LIBRARY, _( "Library" ), wxBitmapBundle::FromSVG( library, wxSize( 16, 16 ) ), wxBitmapBundle::FromSVG( library, wxSize( 16, 16 ) ), wxITEM_NORMAL, _( "Library selector" ) );


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24726/2249156683@github.com>

VZ

unread,
Jul 25, 2024, 1:44:18 PMJul 25
to wx-...@googlegroups.com, Subscribed

There is literally not a single character difference between the original code and the "proper" code you posted, so I have no idea what are you trying to say, but I guess the real issue is that wxQt crashes, instead of just asserting, when being passed an invalid bitmap bundle or bitmap. If so, this indeed should be fixed.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24726/2251064158@github.com>

oneeyeman1

unread,
Jul 25, 2024, 1:51:07 PMJul 25
to wx-...@googlegroups.com, Subscribed

@vadz ,

There is literally not a single character difference between the original code and the "proper" code you posted,

I guess you "need a new glasses", in order to see the "library" vs library. ;-)

Anyway - yes wxGTK just doesn't render the item and wxQt crashes.

I am not sure that wxGTK should assert on the bad bitmap, but...

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24726/2251077638@github.com>

VZ

unread,
Jul 25, 2024, 1:53:16 PMJul 25
to wx-...@googlegroups.com, Subscribed

OK, yes, I missed the difference, thanks for pointing it out. It would certainly have been nicer to be a bit more explicit to begin with.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24726/2251081064@github.com>

Reply all
Reply to author
Forward
0 new messages