From dc373565da18db07d9fa716c7977a8c12fa0e4ba Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 11 Mar 2026 16:39:22 +0100 Subject: [PATCH] qt: Load QPixmap directly from stream in loadQPixmapIcon Don't first create a Bitmap, write that to a stream and then load the QPixmap from that stream, but directly get the stream and load the QPixmap from it. This should not only be more efficient, but not trying to create the intermediate Bitmap object also avoids triggering an infinite recursion when done (too) early on startup, which was seen when using loadQPixmapIcon in QtFrame::SetIcon. (getPixbuf in the gtk vcl plugin implementation in vcl/unx/gtk3/gtkinst.cxx also does similarly.) Sample local change to trigger the infinite recursion previously: diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 6d0c0acd8cfc..b646fd7694dd 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -344,6 +344,8 @@ void QtFrame::SetIcon(sal_uInt16 nIcon) || !isWindow()) return; + loadQPixmapIcon(u"res/writer128.png"_ustr); + const QString sAppIcon = toQString(IconHelper::GetAppIconName(nIcon)); QIcon aIcon = QIcon::fromTheme(sAppIcon); m_pQWidget->window()->setWindowIcon(aIcon); Then, starting e.g. Writer would previosuly trigger an infinite recursion. Partial backtrace: Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007f1c8790834f in QObject::event (this=0x5593589a5a80, e=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qobject.cpp:1452 1452 switch (e->type()) { (rr) bt 100 #0 0x00007f1c8790834f in QObject::event (this=0x5593589a5a80, e=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qobject.cpp:1452 #1 0x00007f1c85872cbd in QWidget::event (this=0x5593589a5a80, event=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:9467 #2 0x00007f1c85af8b85 in QMainWindow::event (this=0x5593589a5a80, event=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp:1272 #3 0x00007f1c857b1a20 in QApplicationPrivate::notify_helper (this=0x559356428970, receiver=0x5593589a5a80, e=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3276 #4 0x00007f1c857b58fb in QApplication::notify (this=0x5593563ce910, receiver=0x5593589a5a80, e=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3222 #5 0x00007f1c87838739 in QCoreApplication::notifyInternal2 (receiver=0x5593589a5a80, event=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1113 #6 0x00007f1c878393a9 in QCoreApplication::sendEvent (receiver=0x5593589a5a80, event=0x7ffe98d56258) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1553 #7 0x00007f1c85854857 in QWidget::setParent (this=0x5593589a5cb0, parent=0x5593589a5a80, f=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:10901 #8 0x00007f1c858746e9 in QWidget::setParent (this=0x5593589a5cb0, parent=0x5593589a5a80) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:10742 #9 0x00007f1c8583080f in QLayout::addChildWidget (this=0x5593589a75a0, w=0x5593589a5cb0) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qlayout.cpp:856 #10 0x00007f1c85b0a1b0 in QMainWindowLayout::setCentralWidget (this=0x5593589a75a0, widget=0x5593589a5cb0) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmainwindowlayout.cpp:2860 #11 0x00007f1c85af7299 in QMainWindow::setCentralWidget (this=0x5593589a5a80, widget=0x5593589a5cb0) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp:555 #12 0x00007f1c8880d74b in QtFrame::QtFrame (this=0x5593589a6e80, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON, bUseCairo=true) at vcl/qt6/../qt5/QtFrame.cxx:143 #13 0x00007f1c8884480d in QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0::operator()() const (this=0x5593589a6e60) at vcl/qt6/../qt5/QtInstance.cxx:396 #14 0x00007f1c88844785 in std::__invoke_impl(std::__invoke_other, QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__f=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:63 #15 0x00007f1c88844745 in std::__invoke_r(QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__fn=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:113 #16 0x00007f1c8884462d in std::_Function_handler::_M_invoke (__functor=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/std_function.h:292 #17 0x00007f1c8884674e in std::function::operator() (this=0x7ffe98d567e8) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/std_function.h:593 #18 0x00007f1c8883d46f in QtInstance::RunInMainThread (this=0x559356428580, func=...) at vcl/qt6/../qt5/QtInstance.cxx:210 #19 0x00007f1c8883f91b in QtInstance::CreateFrame (this=0x559356428580, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON) at vcl/qt6/../qt5/QtInstance.cxx:395 #20 0x00007f1c911468d6 in vcl::Window::ImplInit (this=0x5593589a6620, pParent=0x0, nStyle=274877906944, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:1059 #21 0x00007f1c90ee2de7 in ImplBorderWindow::ImplInit (this=0x5593589a6620, pParent=0x0, nStyle=274877906944, nTypeStyle=BorderWindowStyle::Frame, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1568 #22 0x00007f1c90ee3368 in ImplBorderWindow::ImplBorderWindow (this=0x5593589a6620, pParent=0x0, pSystemParentData=0x0, nStyle=274877906944, nTypeStyle=BorderWindowStyle::Frame) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1597 #23 0x00007f1c9117cb19 in VclPtrInstance::VclPtrInstance (this=0x7ffe98d56da0, arg=@0x7ffe98d56dc0: 0x0, arg=@0x7ffe98d56db0: 0x0, arg=@0x7ffe98d56db8: 274877906944, arg=@0x7ffe98d56dac: BorderWindowStyle::Frame) at include/vcl/vclptr.hxx:274 #24 0x00007f1c9117b405 in WorkWindow::ImplInit (this=0x5593589a5d30, pParent=0x0, nStyle=274877906944, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/wrkwin.cxx:51 #25 0x00007f1c9117bc67 in WorkWindow::WorkWindow (this=0x5593589a5d30, pParent=0x0, nStyle=274877906944) at /home/michi/development/git/libreoffice/vcl/source/window/wrkwin.cxx:95 #26 0x00007f1c9182e653 in VclPtr::Create(decltype(nullptr)&&, long const&) (arg=, arg=@0x7f1c90505ea8: 274877906944) at include/vcl/vclptr.hxx:153 #27 0x00007f1c9182b1bd in ImplGetDefaultContextWindow () at /home/michi/development/git/libreoffice/vcl/source/app/svdata.cxx:283 #28 0x00007f1c9182af8a in ImplGetDefaultWindow () at /home/michi/development/git/libreoffice/vcl/source/app/svdata.cxx:264 #29 0x00007f1c9181c62d in Application::GetDefaultDevice () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:1111 #30 0x00007f1c916fc79d in ImageRequestParameters::scalePercentage (this=0x7ffe98d57970) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:79 #31 0x00007f1c916ffc08 in (anonymous namespace)::createVariant (rParameters=...) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:382 #32 0x00007f1c916ff343 in ImplImageTree::doLoadImage (this=0x559357ba6d30, rParameters=...) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:428 #33 0x00007f1c916ff0d4 in ImplImageTree::loadImage (this=0x559357ba6d30, rName="res/writer128.png", rStyle="breeze", rBitmap=..., localized=true, eFlags=ImageLoadFlags::NONE, nScalePercentage=-1) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:365 #34 0x00007f1c916faa21 in ImageTree::loadImage (this=0x7f1c929bc3f0 , rName="res/writer128.png", rStyle="breeze", rBitmap=..., bLocalized=true, nScalePercentage=-1, eFlags=ImageLoadFlags::NONE) at /home/michi/development/git/libreoffice/vcl/source/image/ImageTree.cxx:47 #35 0x00007f1c916faaac in ImageTree::loadImage (this=0x7f1c929bc3f0 , rName="res/writer128.png", rStyle="breeze", rBitmap=..., bLocalized=true, eFlags=ImageLoadFlags::NONE) at /home/michi/development/git/libreoffice/vcl/source/image/ImageTree.cxx:54 #36 0x00007f1c91671656 in Bitmap::loadFromIconTheme (this=0x7ffe98d57ed0, rIconName="res/writer128.png") at /home/michi/development/git/libreoffice/vcl/source/bitmap/bitmap.cxx:228 #37 0x00007f1c91671543 in Bitmap::Bitmap (this=0x7ffe98d57ed0, rIconName="res/writer128.png") at /home/michi/development/git/libreoffice/vcl/source/bitmap/bitmap.cxx:217 #38 0x00007f1c887bf2a2 in loadQPixmapIcon (rIconName="res/writer128.png") at include/vcl/qt/QtUtils.hxx:80 #39 0x00007f1c8880e04d in QtFrame::SetIcon (this=0x5593589a4420, nIcon=1) at vcl/qt6/../qt5/QtFrame.cxx:347 #40 0x00007f1c8880d88c in QtFrame::QtFrame (this=0x5593589a4420, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON, bUseCairo=true) at vcl/qt6/../qt5/QtFrame.cxx:156 #41 0x00007f1c8884480d in QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0::operator()() const (this=0x5593589a4400) at vcl/qt6/../qt5/QtInstance.cxx:396 #42 0x00007f1c88844785 in std::__invoke_impl(std::__invoke_other, QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__f=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:63 #43 0x00007f1c88844745 in std::__invoke_r(QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__fn=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:113 #44 0x00007f1c8884462d in std::_Function_handler::_M_invoke (__functor=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/std_function.h:292 #45 0x00007f1c8884674e in std::function::operator() (this=0x7ffe98d583a8) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/std_function.h:593 #46 0x00007f1c8883d46f in QtInstance::RunInMainThread (this=0x559356428580, func=...) at vcl/qt6/../qt5/QtInstance.cxx:210 #47 0x00007f1c8883f91b in QtInstance::CreateFrame (this=0x559356428580, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON) at vcl/qt6/../qt5/QtInstance.cxx:395 #48 0x00007f1c911468d6 in vcl::Window::ImplInit (this=0x5593589a3bc0, pParent=0x0, nStyle=274877906944, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:1059 #49 0x00007f1c90ee2de7 in ImplBorderWindow::ImplInit (this=0x5593589a3bc0, pParent=0x0, nStyle=274877906944, nTypeStyle=BorderWindowStyle::Frame, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1568 #50 0x00007f1c90ee3368 in ImplBorderWindow::ImplBorderWindow (this=0x5593589a3bc0, pParent=0x0, pSystemParentData=0x0, nStyle=274877906944, nTypeStyle=BorderWindowStyle::Frame) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1597 #51 0x00007f1c9117cb19 in VclPtrInstance::VclPtrInstance (this=0x7ffe98d58960, arg=@0x7ffe98d58980: 0x0, arg=@0x7ffe98d58970: 0x0, arg=@0x7ffe98d58978: 274877906944, arg=@0x7ffe98d5896c: BorderWindowStyle::Frame) at include/vcl/vclptr.hxx:274 #52 0x00007f1c9117b405 in WorkWindow::ImplInit (this=0x5593589a32d0, pParent=0x0, nStyle=274877906944, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/wrkwin.cxx:51 #53 0x00007f1c9117bc67 in WorkWindow::WorkWindow (this=0x5593589a32d0, pParent=0x0, nStyle=274877906944) at /home/michi/development/git/libreoffice/vcl/source/window/wrkwin.cxx:95 #54 0x00007f1c9182e653 in VclPtr::Create(decltype(nullptr)&&, long const&) (arg=, arg=@0x7f1c90505ea8: 274877906944) at include/vcl/vclptr.hxx:153 #55 0x00007f1c9182b1bd in ImplGetDefaultContextWindow () at /home/michi/development/git/libreoffice/vcl/source/app/svdata.cxx:283 #56 0x00007f1c9182af8a in ImplGetDefaultWindow () at /home/michi/development/git/libreoffice/vcl/source/app/svdata.cxx:264 #57 0x00007f1c9181c62d in Application::GetDefaultDevice () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:1111 #58 0x00007f1c916fc79d in ImageRequestParameters::scalePercentage (this=0x7ffe98d59530) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:79 #59 0x00007f1c916ffc08 in (anonymous namespace)::createVariant (rParameters=...) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:382 #60 0x00007f1c916ff343 in ImplImageTree::doLoadImage (this=0x559357ba6d30, rParameters=...) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:428 #61 0x00007f1c916ff0d4 in ImplImageTree::loadImage (this=0x559357ba6d30, rName="res/writer128.png", rStyle="breeze", rBitmap=..., localized=true, eFlags=ImageLoadFlags::NONE, nScalePercentage=-1) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:365 #62 0x00007f1c916faa21 in ImageTree::loadImage (this=0x7f1c929bc3f0 , rName="res/writer128.png", rStyle="breeze", rBitmap=..., bLocalized=true, nScalePercentage=-1, eFlags=ImageLoadFlags::NONE) at /home/michi/development/git/libreoffice/vcl/source/image/ImageTree.cxx:47 #63 0x00007f1c916faaac in ImageTree::loadImage (this=0x7f1c929bc3f0 , rName="res/writer128.png", rStyle="breeze", rBitmap=..., bLocalized=true, eFlags=ImageLoadFlags::NONE) at /home/michi/development/git/libreoffice/vcl/source/image/ImageTree.cxx:54 #64 0x00007f1c91671656 in Bitmap::loadFromIconTheme (this=0x7ffe98d59a90, rIconName="res/writer128.png") at /home/michi/development/git/libreoffice/vcl/source/bitmap/bitmap.cxx:228 #65 0x00007f1c91671543 in Bitmap::Bitmap (this=0x7ffe98d59a90, rIconName="res/writer128.png") at /home/michi/development/git/libreoffice/vcl/source/bitmap/bitmap.cxx:217 #66 0x00007f1c887bf2a2 in loadQPixmapIcon (rIconName="res/writer128.png") at include/vcl/qt/QtUtils.hxx:80 #67 0x00007f1c8880e04d in QtFrame::SetIcon (this=0x5593589a19c0, nIcon=1) at vcl/qt6/../qt5/QtFrame.cxx:347 #68 0x00007f1c8880d88c in QtFrame::QtFrame (this=0x5593589a19c0, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON, bUseCairo=true) at vcl/qt6/../qt5/QtFrame.cxx:156 #69 0x00007f1c8884480d in QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0::operator()() const (this=0x5593589a19a0) at vcl/qt6/../qt5/QtInstance.cxx:396 #70 0x00007f1c88844785 in std::__invoke_impl(std::__invoke_other, QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__f=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:63 #71 0x00007f1c88844745 in std::__invoke_r(QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__fn=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:113 #72 0x00007f1c8884462d in std::_Function_handler::_M_invoke (__functor=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/std_function.h:292 #73 0x00007f1c8884674e in std::function::operator() (this=0x7ffe98d59f68) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/std_function.h:593 #74 0x00007f1c8883d46f in QtInstance::RunInMainThread (this=0x559356428580, func=...) at vcl/qt6/../qt5/QtInstance.cxx:210 #75 0x00007f1c8883f91b in QtInstance::CreateFrame (this=0x559356428580, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON) at vcl/qt6/../qt5/QtInstance.cxx:395 #76 0x00007f1c911468d6 in vcl::Window::ImplInit (this=0x5593589a1160, pParent=0x0, nStyle=274877906944, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:1059 #77 0x00007f1c90ee2de7 in ImplBorderWindow::ImplInit (this=0x5593589a1160, pParent=0x0, nStyle=274877906944, nTypeStyle=BorderWindowStyle::Frame, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1568 #78 0x00007f1c90ee3368 in ImplBorderWindow::ImplBorderWindow (this=0x5593589a1160, pParent=0x0, pSystemParentData=0x0, nStyle=274877906944, nTypeStyle=BorderWindowStyle::Frame) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1597 #79 0x00007f1c9117cb19 in VclPtrInstance::VclPtrInstance (this=0x7ffe98d5a520, arg=@0x7ffe98d5a540: 0x0, arg=@0x7ffe98d5a530: 0x0, arg=@0x7ffe98d5a538: 274877906944, arg=@0x7ffe98d5a52c: BorderWindowStyle::Frame) at include/vcl/vclptr.hxx:274 #80 0x00007f1c9117b405 in WorkWindow::ImplInit (this=0x5593589a0870, pParent=0x0, nStyle=274877906944, pSystemParentData=0x0) at /home/michi/development/git/libreoffice/vcl/source/window/wrkwin.cxx:51 #81 0x00007f1c9117bc67 in WorkWindow::WorkWindow (this=0x5593589a0870, pParent=0x0, nStyle=274877906944) at /home/michi/development/git/libreoffice/vcl/source/window/wrkwin.cxx:95 #82 0x00007f1c9182e653 in VclPtr::Create(decltype(nullptr)&&, long const&) (arg=, arg=@0x7f1c90505ea8: 274877906944) at include/vcl/vclptr.hxx:153 #83 0x00007f1c9182b1bd in ImplGetDefaultContextWindow () at /home/michi/development/git/libreoffice/vcl/source/app/svdata.cxx:283 #84 0x00007f1c9182af8a in ImplGetDefaultWindow () at /home/michi/development/git/libreoffice/vcl/source/app/svdata.cxx:264 #85 0x00007f1c9181c62d in Application::GetDefaultDevice () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:1111 #86 0x00007f1c916fc79d in ImageRequestParameters::scalePercentage (this=0x7ffe98d5b0f0) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:79 #87 0x00007f1c916ffc08 in (anonymous namespace)::createVariant (rParameters=...) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:382 #88 0x00007f1c916ff343 in ImplImageTree::doLoadImage (this=0x559357ba6d30, rParameters=...) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:428 #89 0x00007f1c916ff0d4 in ImplImageTree::loadImage (this=0x559357ba6d30, rName="res/writer128.png", rStyle="breeze", rBitmap=..., localized=true, eFlags=ImageLoadFlags::NONE, nScalePercentage=-1) at /home/michi/development/git/libreoffice/vcl/source/image/ImplImageTree.cxx:365 #90 0x00007f1c916faa21 in ImageTree::loadImage (this=0x7f1c929bc3f0 , rName="res/writer128.png", rStyle="breeze", rBitmap=..., bLocalized=true, nScalePercentage=-1, eFlags=ImageLoadFlags::NONE) at /home/michi/development/git/libreoffice/vcl/source/image/ImageTree.cxx:47 #91 0x00007f1c916faaac in ImageTree::loadImage (this=0x7f1c929bc3f0 , rName="res/writer128.png", rStyle="breeze", rBitmap=..., bLocalized=true, eFlags=ImageLoadFlags::NONE) at /home/michi/development/git/libreoffice/vcl/source/image/ImageTree.cxx:54 #92 0x00007f1c91671656 in Bitmap::loadFromIconTheme (this=0x7ffe98d5b650, rIconName="res/writer128.png") at /home/michi/development/git/libreoffice/vcl/source/bitmap/bitmap.cxx:228 #93 0x00007f1c91671543 in Bitmap::Bitmap (this=0x7ffe98d5b650, rIconName="res/writer128.png") at /home/michi/development/git/libreoffice/vcl/source/bitmap/bitmap.cxx:217 #94 0x00007f1c887bf2a2 in loadQPixmapIcon (rIconName="res/writer128.png") at include/vcl/qt/QtUtils.hxx:80 #95 0x00007f1c8880e04d in QtFrame::SetIcon (this=0x55935899ef60, nIcon=1) at vcl/qt6/../qt5/QtFrame.cxx:347 #96 0x00007f1c8880d88c in QtFrame::QtFrame (this=0x55935899ef60, pParent=0x0, nStyle=SalFrameStyleFlags::NOICON, bUseCairo=true) at vcl/qt6/../qt5/QtFrame.cxx:156 #97 0x00007f1c8884480d in QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0::operator()() const (this=0x55935899ef40) at vcl/qt6/../qt5/QtInstance.cxx:396 #98 0x00007f1c88844785 in std::__invoke_impl(std::__invoke_other, QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__f=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:63 #99 0x00007f1c88844745 in std::__invoke_r(QtInstance::CreateFrame(SalFrame*, SalFrameStyleFlags)::$_0&) (__fn=...) at /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/invoke.h:113 (More stack frames follow...) Change-Id: I86af1c1d55aa3cbbcc708ccbefbff3556030819d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201486 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- avmedia/Library_avmediaqt6.mk | 1 + include/vcl/qt/QtUtils.hxx | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/avmedia/Library_avmediaqt6.mk b/avmedia/Library_avmediaqt6.mk index 86b4553e1add..e590ff305422 100644 --- a/avmedia/Library_avmediaqt6.mk +++ b/avmedia/Library_avmediaqt6.mk @@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_libraries,avmediaqt6,\ comphelper \ cppu \ cppuhelper \ + i18nlangtag \ sal \ salhelper \ tl \ diff --git a/include/vcl/qt/QtUtils.hxx b/include/vcl/qt/QtUtils.hxx index 455049d6e059..dac8bd6598b0 100644 --- a/include/vcl/qt/QtUtils.hxx +++ b/include/vcl/qt/QtUtils.hxx @@ -18,12 +18,16 @@ * VCL plugins are defined in `vcl/inc/qt5/QtTools.hxx`. **/ +#include #include #include +#include #include #include #include #include +#include +#include #include #include @@ -77,9 +81,12 @@ inline QPixmap toQPixmap(const OutputDevice& rDevice) inline QPixmap loadQPixmapIcon(const OUString& rIconName) { - const Bitmap aBitmap(rIconName); - if (!aBitmap.IsEmpty()) - return toQPixmap(aBitmap); + const OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); + const OUString sLanguage = Application::GetSettings().GetUILanguageTag().getBcp47(); + std::shared_ptr pImageStream + = ImageTree::get().getImageStream(rIconName, sIconTheme, sLanguage); + if (pImageStream) + return loadQPixmap(*pImageStream); const QIcon aIcon = QIcon::fromTheme(toQString(rIconName)); assert(!aIcon.isNull() && "No icon found for that icon name");