2023-12-20 19:13:50 +05:30
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QtInstanceDialog.hxx>
|
2024-10-02 09:13:05 +02:00
|
|
|
#include <QtInstanceDialog.moc>
|
2023-12-20 19:13:50 +05:30
|
|
|
|
2024-09-28 00:30:29 +02:00
|
|
|
const char* const QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE = "response-code";
|
|
|
|
|
2023-12-20 19:13:50 +05:30
|
|
|
QtInstanceDialog::QtInstanceDialog(QDialog* pDialog)
|
2024-01-23 13:45:48 +01:00
|
|
|
: QtInstanceWindow(pDialog)
|
|
|
|
, m_pDialog(pDialog)
|
tdf#130857 qt weld: Move runAsync logic to QtInstanceDialog
Refactor the handling for running a QtInstanceMessageDialog
asynchronously, and reuse the logic for the QtInstanceDialog
base class:
Move implementations for both QtInstanceMessageDialog::runAsync
methods and the involved class members from QtInstanceMessageDialog
to QtInstanceDialog.
Split the previous logic from
QtInstanceMessageDialog::dialogFinished into two methods:
* move most of the logic as is to a new virtual slot
in the base class, QtInstanceDialog::dialogFinished
* override the base class implementation to get the
response code from the actually clicked button
via the PROPERTY_VCL_RESPONSE_CODE property
set on that button, and call the base class
method with that one.
For QtInstanceDialog, there's no QDialog::clickedButton
method that could be used to retrieve the clicked button,
but it's also not needed there, because there a slot
connected to the QAbstractButton::clicked signal that triggers
closing the dialog, and passes the proper response code of the
corresponding button already, see
commit 08b55df5c9e42c1ccb78a156261811875629342a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Sep 28 00:32:15 2024 +0200
tdf#130857 qt weld: Close dialog on button click
With this commit in place, QtInstanceDialog can now
also be run asynchronously, instead of the
QtInstanceDialog::runAsync methods
just returning true without doing anything.
This will be needed e.g. when adding support for the
"Tools" -> "Word Count" dialog in Writer.
Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-10-02 09:33:08 +02:00
|
|
|
, m_aRunAsyncFunc(nullptr)
|
2023-12-20 19:13:50 +05:30
|
|
|
{
|
|
|
|
}
|
|
|
|
|
tdf#162696 qt weld: Destroy QDialog in main thread
Besides the obvious cases handled in previous commit
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Fri Aug 30 10:12:21 2024 +0200
tdf#162696 qt weld: Do GUI things in main thread
, the destruction of `QtInstanceDialog::m_pDialog` (that
previously implicitly happened due to it being a
`std::unique_ptr`) also needs to happen in the main
thread.
Otherwise, it triggers this assert with a debug Qt build
for the tdf#162696 of installing an extension via drag'n'drop
into the start center:
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread QThread(0x7f4b14003390). Receiver 'QDialog(0x562e6ba77450)' was created in thread QThread(0x562e69709f60, name = "Qt mainThread")", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 551
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) [0x7f4be7455590]
#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) [0x7f4be70a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f4be70b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f4bd2eed562]
#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 QCoreApplicationPrivate::checkReceiverThread(QObject*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:0
#15 QApplication::notify(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2583
#16 QCoreApplication::notifyInternal2(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1170
#17 QCoreApplication::sendEvent(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1614
#18 QWidgetPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8415
#19 QDialogPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:832
#20 QMessageBoxPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:1676
#21 QDialog::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:750
#22 QWidget::hide() at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8176
#23 QDialog::~QDialog() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:390
#24 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:879
#25 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:878
#26 std::default_delete<QDialog>::operator()(QDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
#27 std::unique_ptr<QDialog, std::default_delete<QDialog>>::~unique_ptr() at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:398
#28 QtInstanceDialog::~QtInstanceDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceDialog.hxx:14
#29 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
#30 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
#31 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
#32 std::default_delete<weld::MessageDialog>::operator()(weld::MessageDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
#33 std::__uniq_ptr_impl<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:206
#34 std::unique_ptr<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:504
#35 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:379
#36 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:477
#37 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
#38 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#39 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#40 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#41 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#42 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#43 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#44 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#45 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#46 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#47 start_thread at ./nptl/pthread_create.c:447
#48 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Idb5b20bde8c306ed14efd5467887d55fdf470202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172643
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-08-30 10:14:04 +02:00
|
|
|
QtInstanceDialog::~QtInstanceDialog()
|
|
|
|
{
|
|
|
|
SolarMutexGuard g;
|
2024-09-27 09:08:43 +02:00
|
|
|
GetQtInstance().RunInMainThread([&] { m_pDialog.reset(); });
|
tdf#162696 qt weld: Destroy QDialog in main thread
Besides the obvious cases handled in previous commit
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Fri Aug 30 10:12:21 2024 +0200
tdf#162696 qt weld: Do GUI things in main thread
, the destruction of `QtInstanceDialog::m_pDialog` (that
previously implicitly happened due to it being a
`std::unique_ptr`) also needs to happen in the main
thread.
Otherwise, it triggers this assert with a debug Qt build
for the tdf#162696 of installing an extension via drag'n'drop
into the start center:
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread QThread(0x7f4b14003390). Receiver 'QDialog(0x562e6ba77450)' was created in thread QThread(0x562e69709f60, name = "Qt mainThread")", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 551
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) [0x7f4be7455590]
#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) [0x7f4be70a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f4be70b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f4bd2eed562]
#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 QCoreApplicationPrivate::checkReceiverThread(QObject*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:0
#15 QApplication::notify(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2583
#16 QCoreApplication::notifyInternal2(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1170
#17 QCoreApplication::sendEvent(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1614
#18 QWidgetPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8415
#19 QDialogPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:832
#20 QMessageBoxPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:1676
#21 QDialog::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:750
#22 QWidget::hide() at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8176
#23 QDialog::~QDialog() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:390
#24 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:879
#25 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:878
#26 std::default_delete<QDialog>::operator()(QDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
#27 std::unique_ptr<QDialog, std::default_delete<QDialog>>::~unique_ptr() at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:398
#28 QtInstanceDialog::~QtInstanceDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceDialog.hxx:14
#29 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
#30 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
#31 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
#32 std::default_delete<weld::MessageDialog>::operator()(weld::MessageDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
#33 std::__uniq_ptr_impl<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:206
#34 std::unique_ptr<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:504
#35 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:379
#36 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:477
#37 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
#38 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#39 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#40 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#41 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#42 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#43 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#44 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#45 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#46 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#47 start_thread at ./nptl/pthread_create.c:447
#48 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Idb5b20bde8c306ed14efd5467887d55fdf470202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172643
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-08-30 10:14:04 +02:00
|
|
|
}
|
|
|
|
|
tdf#130857 qt weld: Move runAsync logic to QtInstanceDialog
Refactor the handling for running a QtInstanceMessageDialog
asynchronously, and reuse the logic for the QtInstanceDialog
base class:
Move implementations for both QtInstanceMessageDialog::runAsync
methods and the involved class members from QtInstanceMessageDialog
to QtInstanceDialog.
Split the previous logic from
QtInstanceMessageDialog::dialogFinished into two methods:
* move most of the logic as is to a new virtual slot
in the base class, QtInstanceDialog::dialogFinished
* override the base class implementation to get the
response code from the actually clicked button
via the PROPERTY_VCL_RESPONSE_CODE property
set on that button, and call the base class
method with that one.
For QtInstanceDialog, there's no QDialog::clickedButton
method that could be used to retrieve the clicked button,
but it's also not needed there, because there a slot
connected to the QAbstractButton::clicked signal that triggers
closing the dialog, and passes the proper response code of the
corresponding button already, see
commit 08b55df5c9e42c1ccb78a156261811875629342a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Sep 28 00:32:15 2024 +0200
tdf#130857 qt weld: Close dialog on button click
With this commit in place, QtInstanceDialog can now
also be run asynchronously, instead of the
QtInstanceDialog::runAsync methods
just returning true without doing anything.
This will be needed e.g. when adding support for the
"Tools" -> "Word Count" dialog in Writer.
Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-10-02 09:33:08 +02:00
|
|
|
bool QtInstanceDialog::runAsync(const std::shared_ptr<weld::DialogController>& rxOwner,
|
|
|
|
const std::function<void(sal_Int32)>& func)
|
2023-12-20 19:13:50 +05:30
|
|
|
{
|
tdf#130857 qt weld: Move runAsync logic to QtInstanceDialog
Refactor the handling for running a QtInstanceMessageDialog
asynchronously, and reuse the logic for the QtInstanceDialog
base class:
Move implementations for both QtInstanceMessageDialog::runAsync
methods and the involved class members from QtInstanceMessageDialog
to QtInstanceDialog.
Split the previous logic from
QtInstanceMessageDialog::dialogFinished into two methods:
* move most of the logic as is to a new virtual slot
in the base class, QtInstanceDialog::dialogFinished
* override the base class implementation to get the
response code from the actually clicked button
via the PROPERTY_VCL_RESPONSE_CODE property
set on that button, and call the base class
method with that one.
For QtInstanceDialog, there's no QDialog::clickedButton
method that could be used to retrieve the clicked button,
but it's also not needed there, because there a slot
connected to the QAbstractButton::clicked signal that triggers
closing the dialog, and passes the proper response code of the
corresponding button already, see
commit 08b55df5c9e42c1ccb78a156261811875629342a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Sep 28 00:32:15 2024 +0200
tdf#130857 qt weld: Close dialog on button click
With this commit in place, QtInstanceDialog can now
also be run asynchronously, instead of the
QtInstanceDialog::runAsync methods
just returning true without doing anything.
This will be needed e.g. when adding support for the
"Tools" -> "Word Count" dialog in Writer.
Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-10-02 09:33:08 +02:00
|
|
|
SolarMutexGuard g;
|
|
|
|
QtInstance& rQtInstance = GetQtInstance();
|
|
|
|
if (!rQtInstance.IsMainThread())
|
|
|
|
{
|
|
|
|
bool bRet = false;
|
|
|
|
rQtInstance.RunInMainThread([&] { bRet = runAsync(rxOwner, func); });
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(m_pDialog);
|
|
|
|
|
|
|
|
m_xRunAsyncDialogController = rxOwner;
|
|
|
|
m_aRunAsyncFunc = func;
|
|
|
|
connect(m_pDialog.get(), &QDialog::finished, this, &QtInstanceDialog::dialogFinished);
|
|
|
|
m_pDialog->open();
|
|
|
|
|
2023-12-20 19:13:50 +05:30
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
tdf#130857 qt weld: Move runAsync logic to QtInstanceDialog
Refactor the handling for running a QtInstanceMessageDialog
asynchronously, and reuse the logic for the QtInstanceDialog
base class:
Move implementations for both QtInstanceMessageDialog::runAsync
methods and the involved class members from QtInstanceMessageDialog
to QtInstanceDialog.
Split the previous logic from
QtInstanceMessageDialog::dialogFinished into two methods:
* move most of the logic as is to a new virtual slot
in the base class, QtInstanceDialog::dialogFinished
* override the base class implementation to get the
response code from the actually clicked button
via the PROPERTY_VCL_RESPONSE_CODE property
set on that button, and call the base class
method with that one.
For QtInstanceDialog, there's no QDialog::clickedButton
method that could be used to retrieve the clicked button,
but it's also not needed there, because there a slot
connected to the QAbstractButton::clicked signal that triggers
closing the dialog, and passes the proper response code of the
corresponding button already, see
commit 08b55df5c9e42c1ccb78a156261811875629342a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Sep 28 00:32:15 2024 +0200
tdf#130857 qt weld: Close dialog on button click
With this commit in place, QtInstanceDialog can now
also be run asynchronously, instead of the
QtInstanceDialog::runAsync methods
just returning true without doing anything.
This will be needed e.g. when adding support for the
"Tools" -> "Word Count" dialog in Writer.
Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-10-02 09:33:08 +02:00
|
|
|
bool QtInstanceDialog::runAsync(std::shared_ptr<Dialog> const& rxSelf,
|
|
|
|
const std::function<void(sal_Int32)>& func)
|
2023-12-20 19:13:50 +05:30
|
|
|
{
|
tdf#130857 qt weld: Move runAsync logic to QtInstanceDialog
Refactor the handling for running a QtInstanceMessageDialog
asynchronously, and reuse the logic for the QtInstanceDialog
base class:
Move implementations for both QtInstanceMessageDialog::runAsync
methods and the involved class members from QtInstanceMessageDialog
to QtInstanceDialog.
Split the previous logic from
QtInstanceMessageDialog::dialogFinished into two methods:
* move most of the logic as is to a new virtual slot
in the base class, QtInstanceDialog::dialogFinished
* override the base class implementation to get the
response code from the actually clicked button
via the PROPERTY_VCL_RESPONSE_CODE property
set on that button, and call the base class
method with that one.
For QtInstanceDialog, there's no QDialog::clickedButton
method that could be used to retrieve the clicked button,
but it's also not needed there, because there a slot
connected to the QAbstractButton::clicked signal that triggers
closing the dialog, and passes the proper response code of the
corresponding button already, see
commit 08b55df5c9e42c1ccb78a156261811875629342a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Sep 28 00:32:15 2024 +0200
tdf#130857 qt weld: Close dialog on button click
With this commit in place, QtInstanceDialog can now
also be run asynchronously, instead of the
QtInstanceDialog::runAsync methods
just returning true without doing anything.
This will be needed e.g. when adding support for the
"Tools" -> "Word Count" dialog in Writer.
Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-10-02 09:33:08 +02:00
|
|
|
SolarMutexGuard g;
|
|
|
|
QtInstance& rQtInstance = GetQtInstance();
|
|
|
|
if (!rQtInstance.IsMainThread())
|
|
|
|
{
|
|
|
|
bool bRet;
|
|
|
|
rQtInstance.RunInMainThread([&] { bRet = runAsync(rxSelf, func); });
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(m_pDialog);
|
|
|
|
assert(rxSelf.get() == this);
|
|
|
|
|
|
|
|
m_xRunAsyncDialog = rxSelf;
|
|
|
|
m_aRunAsyncFunc = func;
|
|
|
|
connect(m_pDialog.get(), &QDialog::finished, this, &QtInstanceDialog::dialogFinished);
|
|
|
|
m_pDialog->open();
|
|
|
|
|
2023-12-20 19:13:50 +05:30
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtInstanceDialog::collapse(weld::Widget*, weld::Widget*) {}
|
|
|
|
|
|
|
|
void QtInstanceDialog::undo_collapse() {}
|
|
|
|
|
|
|
|
void QtInstanceDialog::SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>&)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
int QtInstanceDialog::run()
|
|
|
|
{
|
|
|
|
SolarMutexGuard g;
|
2024-09-27 09:08:43 +02:00
|
|
|
QtInstance& rQtInstance = GetQtInstance();
|
|
|
|
if (!rQtInstance.IsMainThread())
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
{
|
|
|
|
int nResult = 0;
|
2024-09-27 09:08:43 +02:00
|
|
|
rQtInstance.RunInMainThread([&] { nResult = run(); });
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
return nResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
return qtResponseTypeToVclResponseType(m_pDialog->exec());
|
|
|
|
}
|
2023-12-20 19:13:50 +05:30
|
|
|
|
|
|
|
void QtInstanceDialog::response(int) {}
|
|
|
|
|
|
|
|
void QtInstanceDialog::add_button(const OUString&, int, const OUString&) {}
|
|
|
|
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
void QtInstanceDialog::set_modal(bool bModal)
|
|
|
|
{
|
|
|
|
SolarMutexGuard g;
|
2024-09-27 09:08:43 +02:00
|
|
|
QtInstance& rQtInstance = GetQtInstance();
|
|
|
|
if (!rQtInstance.IsMainThread())
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
{
|
2024-09-27 09:08:43 +02:00
|
|
|
rQtInstance.RunInMainThread([&] { set_modal(bModal); });
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_pDialog->setModal(bModal);
|
|
|
|
}
|
2023-12-20 19:13:50 +05:30
|
|
|
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
bool QtInstanceDialog::get_modal() const
|
|
|
|
{
|
|
|
|
SolarMutexGuard g;
|
2024-09-27 09:08:43 +02:00
|
|
|
QtInstance& rQtInstance = GetQtInstance();
|
|
|
|
if (!rQtInstance.IsMainThread())
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
{
|
|
|
|
bool bModal = false;
|
2024-09-27 09:08:43 +02:00
|
|
|
rQtInstance.RunInMainThread([&] { bModal = get_modal(); });
|
tdf#162696 qt weld: Do GUI things in main thread
Creating or modifying native Qt UI elements needs
to happen in the main thread.
This commit takes care of the obvious cases where
such interaction happens.
Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:
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) [0x7fdb05455590]
#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) [0x7fdb050a1a3d]
#9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
#10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
#11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
#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 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
#17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
#18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
#19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
#20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
#21 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:477
#22 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
#23 dp_manager::ExtensionManager::checkInstall(rtl::OUString 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:1315
#24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
#25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:655
#26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> 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:0
#27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
#28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
#29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
#30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
#31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
#32 start_thread at ./nptl/pthread_create.c:447
#33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80
Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-30 10:12:21 +02:00
|
|
|
return bModal;
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_pDialog->isModal();
|
|
|
|
}
|
2023-12-20 19:13:50 +05:30
|
|
|
|
|
|
|
weld::Button* QtInstanceDialog::weld_widget_for_response(int) { return nullptr; }
|
|
|
|
|
|
|
|
void QtInstanceDialog::set_default_response(int) {}
|
|
|
|
|
|
|
|
weld::Container* QtInstanceDialog::weld_content_area() { return nullptr; }
|
|
|
|
|
tdf#130857 qt weld: Move runAsync logic to QtInstanceDialog
Refactor the handling for running a QtInstanceMessageDialog
asynchronously, and reuse the logic for the QtInstanceDialog
base class:
Move implementations for both QtInstanceMessageDialog::runAsync
methods and the involved class members from QtInstanceMessageDialog
to QtInstanceDialog.
Split the previous logic from
QtInstanceMessageDialog::dialogFinished into two methods:
* move most of the logic as is to a new virtual slot
in the base class, QtInstanceDialog::dialogFinished
* override the base class implementation to get the
response code from the actually clicked button
via the PROPERTY_VCL_RESPONSE_CODE property
set on that button, and call the base class
method with that one.
For QtInstanceDialog, there's no QDialog::clickedButton
method that could be used to retrieve the clicked button,
but it's also not needed there, because there a slot
connected to the QAbstractButton::clicked signal that triggers
closing the dialog, and passes the proper response code of the
corresponding button already, see
commit 08b55df5c9e42c1ccb78a156261811875629342a
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Sep 28 00:32:15 2024 +0200
tdf#130857 qt weld: Close dialog on button click
With this commit in place, QtInstanceDialog can now
also be run asynchronously, instead of the
QtInstanceDialog::runAsync methods
just returning true without doing anything.
This will be needed e.g. when adding support for the
"Tools" -> "Word Count" dialog in Writer.
Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-10-02 09:33:08 +02:00
|
|
|
void QtInstanceDialog::dialogFinished(int nResult)
|
|
|
|
{
|
|
|
|
SolarMutexGuard g;
|
|
|
|
QtInstance& rQtInstance = GetQtInstance();
|
|
|
|
if (!rQtInstance.IsMainThread())
|
|
|
|
{
|
|
|
|
rQtInstance.RunInMainThread([&] { dialogFinished(nResult); });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(m_aRunAsyncFunc);
|
|
|
|
|
|
|
|
disconnect(m_pDialog.get(), &QDialog::finished, this, &QtInstanceDialog::dialogFinished);
|
|
|
|
|
|
|
|
// use local variables for these, as members might have got de-allocated by the time they're reset
|
|
|
|
std::shared_ptr<weld::Dialog> xRunAsyncDialog = m_xRunAsyncDialog;
|
|
|
|
std::shared_ptr<weld::DialogController> xRunAsyncDialogController = m_xRunAsyncDialogController;
|
|
|
|
std::function<void(sal_Int32)> aFunc = m_aRunAsyncFunc;
|
|
|
|
m_aRunAsyncFunc = nullptr;
|
|
|
|
m_xRunAsyncDialogController.reset();
|
|
|
|
m_xRunAsyncDialog.reset();
|
|
|
|
|
|
|
|
aFunc(nResult);
|
|
|
|
|
|
|
|
xRunAsyncDialogController.reset();
|
|
|
|
xRunAsyncDialog.reset();
|
|
|
|
}
|
|
|
|
|
2024-10-04 12:50:10 +02:00
|
|
|
void QtInstanceDialog::handleButtonClick(QDialog& rDialog, const QAbstractButton& rButton)
|
|
|
|
{
|
|
|
|
QVariant aResponseProperty = rButton.property(QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE);
|
|
|
|
if (aResponseProperty.isValid())
|
|
|
|
{
|
|
|
|
assert(aResponseProperty.canConvert<int>());
|
|
|
|
const int nResponseCode = aResponseProperty.toInt();
|
|
|
|
rDialog.done(nResponseCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-20 19:13:50 +05:30
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|