summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-08-30 17:20:41 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-08-31 18:27:50 +0200
commit5ef991ffc226424a673662b6e478db124825022a (patch)
treee44f8f3b36744158593b3239d4c529af520b0677 /vcl
parente40544bcc5a671b2bc753faa5f843f8fe97ff793 (diff)
tdf#162696 qt: Always run QtFrame::SetPosSize in main thread
This fixes the following assert seen with the qt6 VCL plugin when run with a current Qt 6 dev debug build for the tdf#162696 scenario when when native Qt widgets (currently only message dialogs are implmeneted) are explicitly disabled using `SAL_VCL_QT_NO_WELDED_WIDGETS=1`. ASSERT failure in QWidget: "Widgets must be created in the GUI thread.", file /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp, line 958 terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException' Fatal exception: Signal 6 Stack: #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42 #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289 #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330 #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427 #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7f73cbe55590] #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1) #6 raise at ./signal/../sysdeps/posix/raise.c:27 #7 abort at ./stdlib/abort.c:81 #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7f73cbaa1a3d] #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f73cbab306a] #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6 #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f73b78ed562] #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901 #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0 #14 QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:959 #15 QWidget::QWidget(QWidgetPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:878 #16 QMenuBar::QMenuBar(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmenubar.cpp:715 #17 QMainWindow::menuBar() const at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp:468 #18 QtFrame::menuBarOffset() const at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:462 #19 QtFrame::SetDefaultPos() at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:479 #20 QtFrame::SetPosSize(long, long, long, long, unsigned short) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:565 #21 vcl::Window::setPosSizePixel(long, long, long, long, PosSizeFlags) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:2786 #22 vcl::Window::SetSizePixel(Size const&) at /home/michi/development/git/libreoffice/vcl/source/window/window2.cxx:1344 #23 SystemWindow::setOptimalLayoutSize(bool) at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1085 #24 SystemWindow::DoInitialLayout() at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1098 #25 Dialog::StateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:761 #26 MessageDialog::StateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/layout.cxx:2706 #27 vcl::Window::CompatStateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:3921 #28 vcl::Window::ImplCallInitShow() at /home/michi/development/git/libreoffice/vcl/source/window/event.cxx:496 #29 vcl::Window::Show(bool, ShowFlags) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:2312 #30 Dialog::ImplStartExecute() at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:1021 #31 Dialog::Execute() at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:1071 #32 SalInstanceDialog::run() at /home/michi/development/git/libreoffice/vcl/source/app/salvtables.cxx:1898 #33 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:459 #34 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114 #35 dp_manager::ExtensionManager::checkUpdate(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1348 [...] Change-Id: I9eb0ac63c50de3c713328d0466cb01ea90251741 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172685 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/QtFrame.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 032956168768..f1aa98e8cddd 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -526,6 +526,13 @@ void QtFrame::SetDefaultSize()
void QtFrame::SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
sal_uInt16 nFlags)
{
+ SolarMutexGuard g;
+ QtInstance* pQtInstance = GetQtInstance();
+ if (!pQtInstance->IsMainThread())
+ {
+ pQtInstance->RunInMainThread([&] { SetPosSize(nX, nY, nWidth, nHeight, nFlags); });
+ }
+
if (!isWindow() || isChild(true, false))
return;