svx/source/form/fmpage.cxx      |   31 +++++++++++++++----------------
 vcl/qt5/QtGraphics_Controls.cxx |   23 +++++++++++++++++------
 2 files changed, 32 insertions(+), 22 deletions(-)

New commits:
commit 6347c89711903834cc9188abda5d5a253053b789
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Apr 11 11:02:41 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 11 23:54:21 2024 +0200

    tdf#160176 svx: Reset help text when form control has none
    
    In `FmFormPage::RequestHelp`, also call
    `Help::ShowQuickHelp`/`Help::ShowBalloon` when
    the help text is empty, as that is the way to
    unset the help text/remove the tooltip again,
    see `ImplShowHelpWindow` in `vcl/source/app/help.cxx`:
    
    For the case of non-native tooltips (e.g. the
    gen VCL plugin on Linux), the `bRemoveHelp = true`
    code path is relevant.
    For qt5/qt6/kf5/kf6 which use native tooltips,
    the call to
    
        pParent->ImplGetFrame()->ShowTooltip(rHelpText, rHelpArea)
    
    further up sets the `QtFrame`'s `m_aTooltipText` member
    to an empty string, which prevents showing the outdated
    help text for the `QEvent::ToolTip` event in
    `QtWidget::handleEvent`.
    
    Change-Id: Iceb2424d9c72ae46333a718c677629122e517f11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166006
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index 8c24f3cc22ae..6e4f2093d011 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -139,22 +139,21 @@ bool FmFormPage::RequestHelp( vcl::Window* pWindow, 
SdrView const * pView,
                 }
         }
     }
-    if ( !aHelpText.isEmpty() )
-    {
-        // display the help
-        tools::Rectangle aItemRect = pObj->GetCurrentBoundRect();
-        aItemRect = pWindow->LogicToPixel( aItemRect );
-        Point aPt = pWindow->OutputToScreenPixel( aItemRect.TopLeft() );
-        aItemRect.SetLeft( aPt.X() );
-        aItemRect.SetTop( aPt.Y() );
-        aPt = pWindow->OutputToScreenPixel( aItemRect.BottomRight() );
-        aItemRect.SetRight( aPt.X() );
-        aItemRect.SetBottom( aPt.Y() );
-        if( rEvt.GetMode() == HelpEventMode::BALLOON )
-            Help::ShowBalloon( pWindow, aItemRect.Center(), aItemRect, 
aHelpText);
-        else
-            Help::ShowQuickHelp( pWindow, aItemRect, aHelpText );
-    }
+
+    // display the help
+    tools::Rectangle aItemRect = pObj->GetCurrentBoundRect();
+    aItemRect = pWindow->LogicToPixel( aItemRect );
+    Point aPt = pWindow->OutputToScreenPixel( aItemRect.TopLeft() );
+    aItemRect.SetLeft( aPt.X() );
+    aItemRect.SetTop( aPt.Y() );
+    aPt = pWindow->OutputToScreenPixel( aItemRect.BottomRight() );
+    aItemRect.SetRight( aPt.X() );
+    aItemRect.SetBottom( aPt.Y() );
+    if( rEvt.GetMode() == HelpEventMode::BALLOON )
+        Help::ShowBalloon( pWindow, aItemRect.Center(), aItemRect, aHelpText);
+    else
+        Help::ShowQuickHelp( pWindow, aItemRect, aHelpText );
+
     return true;
 }
 
commit bf4ec3b2beb8121614b8a4098061f49f851b30f8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Apr 11 10:31:40 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 11 23:54:14 2024 +0200

    related tdf#160176 qt: Create dummy Qt widget in main thread
    
    Always run `QtGraphics_Controls::getNativeControlRegion`
    in the main thread, as it may create a dummy `QLineEdit`
    (see the `ControlType::MultilineEditbox` and
    `ControlType::Editbox` cases) and creating Qt widgets
    is only allowed in the main thread.
    
    Without the following scenario runs into an assert
    with a current Qt 6 dev debug build when using the
    qt6 VCL plugin:
    
    1) open sample document attachment 193089
       from tdf#160176
    2) enable Form Design Toolbar
    3) switch to Design mode
    4) select label next to "Labelfield2" label
    5) right-click, "Control Properties"
    6) type anything for the help text and tab
       to the next UI element
    
    Backtrace:
    
        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 956
    
        Thread 45 "browserlistbox" received signal SIGABRT, Aborted.
        [Switching to Thread 0x7fff8d08d6c0 (LWP 203558)]
        __pthread_kill_implementation (threadid=<optimized out>, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        44      ./nptl/pthread_kill.c: No such file or directory.
        (gdb) bt
        #0  __pthread_kill_implementation (threadid=<optimized out>, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        #1  0x00007ffff78a81cf in __pthread_kill_internal (signo=6, 
threadid=<optimized out>) at ./nptl/pthread_kill.c:78
        #2  0x00007ffff785a472 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/posix/raise.c:26
        #3  0x00007ffff78444b2 in __GI_abort () at ./stdlib/abort.c:79
        #4  0x00007fffe32f8540 in qAbort() () at 
/home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:49
        #5  0x00007fffe330c393 in qt_message_fatal<QString&>(QtMsgType, 
QMessageLogContext const&, QString&) (context=..., message=...) at 
/home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2056
        #6  0x00007fffe3305344 in qt_message(QtMsgType, const 
QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *)
            (msgType=QtFatalMsg, context=..., msg=0x7fffe3981990 "ASSERT 
failure in %s: \"%s\", file %s, line %d", ap=0x7fff8d086178) at 
/home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:374
        #7  0x00007fffe330740f in QMessageLogger::fatal(char const*, ...) const 
(this=0x7fff8d0863c0, msg=0x7fffe3981990 "ASSERT failure in %s: \"%s\", file 
%s, line %d")
            at 
/home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:874
        #8  0x00007fffe32f8613 in qt_assert_x(char const*, char const*, char 
const*, int)
            (where=0x7fffe1becdf3 "QWidget", what=0x7fffe1becdc8 "Widgets must 
be created in the GUI thread.", file=0x7fffe1becca0 
"/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp", 
line=956)
            at 
/home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:114
        #9  0x00007fffe144118c in QWidgetPrivate::init(QWidget*, 
QFlags<Qt::WindowType>) (this=0x7fff780054d0, parentWidget=0x0, f=...) at 
/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:956
        #10 0x00007fffe1440ca1 in QWidget::QWidget(QWidgetPrivate&, QWidget*, 
QFlags<Qt::WindowType>) (this=0x7fff8d086d00, dd=..., parent=0x0, f=...) at 
/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:872
        #11 0x00007fffe16a7d22 in QLineEdit::QLineEdit(QString const&, 
QWidget*) (this=0x7fff8d086d00, contents=..., parent=0x0) at 
/home/michi/development/git/qt5/qtbase/src/widgets/widgets/qlineedit.cpp:253
        #12 0x00007fffe16a7c98 in QLineEdit::QLineEdit(QWidget*) 
(this=0x7fff8d086d00, parent=0x0) at 
/home/michi/development/git/qt5/qtbase/src/widgets/widgets/qlineedit.cpp:239
        #13 0x00007fffe404aebc in 
QtGraphics_Controls::getNativeControlRegion(ControlType, ControlPart, 
tools::Rectangle const&, ControlState, ImplControlValue const&, rtl::OUString 
const&, tools::Rectangle&, tools::Rectangle&)
            (this=0x55555cbb13e0, type=ControlType::Editbox, 
part=ControlPart::Entire, controlRegion=..., 
controlState=(ControlState::ENABLED | ControlState::ROLLOVER), val=..., 
nativeBoundingRegion=..., nativeContentRegion=...)
            at vcl/qt6/../qt5/QtGraphics_Controls.cxx:784
        #14 0x00007fffee72945e in 
SalGraphics::GetNativeControlRegion(ControlType, ControlPart, tools::Rectangle 
const&, ControlState, ImplControlValue const&, tools::Rectangle&, 
tools::Rectangle&, OutputDevice const&)
            (this=0x55555eb28920, nType=ControlType::Editbox, 
nPart=ControlPart::Entire, rControlRegion=..., nState=(ControlState::ENABLED | 
ControlState::ROLLOVER), aValue=..., rNativeBoundingRegion=..., 
rNativeContentRegion=..., rOutDev=...)
            at 
/home/michi/development/git/libreoffice/vcl/source/gdi/salgdilayout.cxx:834
        #15 0x00007fffee3a7195 in 
OutputDevice::GetNativeControlRegion(ControlType, ControlPart, tools::Rectangle 
const&, ControlState, ImplControlValue const&, tools::Rectangle&, 
tools::Rectangle&) const
            (this=0x5555607cd870, nType=ControlType::Editbox, 
nPart=ControlPart::Entire, rControlRegion=..., nState=(ControlState::ENABLED | 
ControlState::ROLLOVER), aValue=..., rNativeBoundingRegion=..., 
rNativeContentRegion=...)
            at 
/home/michi/development/git/libreoffice/vcl/source/outdev/nativecontrols.cxx:313
        #16 0x00007fffede63b9d in 
ImplSmallBorderWindowView::DrawWindow(OutputDevice&, Point const*) 
(this=0x5555607c7c10, rRenderContext=...) at 
/home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:699
        #17 0x00007fffede69900 in ImplBorderWindow::Paint(OutputDevice&, 
tools::Rectangle const&) (this=0x5555607c7ca0, rRenderContext=...) at 
/home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1628
        #18 0x00007fffede3e241 in PaintHelper::DoPaint(vcl::Region const*) 
(this=0x7fff8d088188, pRegion=0x7fff78006480) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:313
        #19 0x00007fffede3feff in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x5555607c7ca0, pRegion=0x7fff78006480, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:617
        #20 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d0883c8) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #21 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55556002ead0, pRegion=0x7fff78005ec0, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #22 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d088608) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #23 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555edac0e0, pRegion=0x7fff78005dc0, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #24 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d088848) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #25 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555edab480, pRegion=0x7fff78005d80, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #26 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d088a88) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #27 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555edaa900, pRegion=0x7fff78004c40, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #28 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d088cc8) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #29 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555ed29400, pRegion=0x7fff78004c00, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #30 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d088f08) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #31 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555eccc910, pRegion=0x7fff78005d40, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #32 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d089148) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #33 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555eda7a70, pRegion=0x7fff78004ac0, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        --Type <RET> for more, q to quit, c to continue without paging--
        #34 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d089388) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #35 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555eda2210, pRegion=0x7fff78001230, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #36 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d0895c8) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #37 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555ecd5d20, pRegion=0x7fff78002510, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #38 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d089808) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #39 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555ecdae90, pRegion=0x7fff78001ae0, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #40 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d089a48) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #41 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555bb5ddb0, pRegion=0x55555eb4e340, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #42 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d089c88) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #43 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags)
            (this=0x55555ed5c6e0, pRegion=0x7fff78001310, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase)) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #44 0x00007fffede3f791 in PaintHelper::~PaintHelper() 
(this=0x7fff8d089ec8) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
        #45 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region 
const*, ImplPaintFlags) (this=0x55555eb3aa10, pRegion=0x0, 
nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | 
ImplPaintFlags::Erase))
            at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
        #46 0x00007fffede41a32 in vcl::Window::PaintImmediately() 
(this=0x5555607c7ca0) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:1340
        #47 0x00007fffede415a0 in vcl::Window::PaintImmediately() 
(this=0x5555607c49b0) at 
/home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:1280
        #48 0x00007fffee17f7ac in Edit::ImplInvalidateOrRepaint() 
(this=0x5555607c49b0) at 
/home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:451
        #49 0x00007fffee182a52 in Edit::ImplAlignAndPaint() 
(this=0x5555607c49b0) at 
/home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:1170
        #50 0x00007fffee183ef0 in Edit::ImplInsertText(rtl::OUString const&, 
Selection const*, bool) (this=0x5555607c49b0, rStr="ee", 
pNewSel=0x7fff8d08a6b8, bIsUserInput=false)
            at 
/home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:885
        #51 0x00007fffee1841ca in Edit::ImplSetText(rtl::OUString const&, 
Selection const*) (this=0x5555607c49b0, rText="ee", 
pNewSelection=0x7fff8d08a6b8) at 
/home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:918
        #52 0x00007fffee18cfd4 in Edit::SetText(rtl::OUString const&) 
(this=0x5555607c49b0, rStr="ee") at 
/home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:2560
        #53 0x00007fffee8d974a in SalInstanceEntry::set_text(rtl::OUString 
const&) (this=0x5555607c4200, rText="ee") at 
/home/michi/development/git/libreoffice/vcl/source/app/salvtables.cxx:3383
        #54 0x00007fff7ef6054a in 
pcr::OEditControl::setValue(com::sun::star::uno::Any const&) 
(this=0x5555607c7660, _rValue=uno::Any("string": "ee"))
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/standardcontrol.cxx:200
        #55 0x00007fff7ed96819 in 
pcr::OBrowserListBox::impl_setControlAsPropertyValue(pcr::ListBoxLine const&, 
com::sun::star::uno::Any const&) (_rLine=..., 
_rPropertyValue=uno::Any("string": "ee"))
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:551
        #56 0x00007fff7ed96485 in 
pcr::OBrowserListBox::SetPropertyValue(rtl::OUString const&, 
com::sun::star::uno::Any const&, bool) (this=0x55555eda22b0, 
_rEntryName="HelpText", _rValue=uno::Any("string": "ee"), _bUnknownValue=false)
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:403
        #57 0x00007fff7ef432e8 in 
pcr::OPropertyEditor::SetPropertyValue(rtl::OUString const&, 
com::sun::star::uno::Any const&, bool) (this=0x55555ecdb3e0, 
rEntryName="HelpText", _rValue=uno::Any("string": "ee"), _bUnknownValue=false)
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/propertyeditor.cxx:277
        #58 0x00007fff7ef01d4f in 
pcr::OPropertyBrowserController::Commit(rtl::OUString const&, 
com::sun::star::uno::Any const&) (this=0x55555c5f1b40, rName="HelpText", 
_rValue=uno::Any("string": "ee"))
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/propcontroller.cxx:1337
        #59 0x00007fff7ed954ae in 
pcr::OBrowserListBox::valueChanged(com::sun::star::uno::Reference<com::sun::star::inspection::XPropertyControl>
 const&) (this=0x55555eda22b0, _rxControl=uno::Reference to (pcr::OEditControl 
*) 0x5555607c76b0)
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:637
        #60 0x00007fff7ed95268 in 
pcr::PropertyControlContext_Impl::impl_processEvent_throw(comphelper::AnyEvent 
const&) (this=0x55555ed29270, _rEvent=...)
            at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:291
        #61 0x00007fff7ed950b9 in 
pcr::PropertyControlContext_Impl::processEvent(comphelper::AnyEvent const&) 
(this=0x55555ed29270, _rEvent=...) at 
/home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:272
        #62 0x00007ffff6118a2e in comphelper::AsyncEventNotifierBase::execute() 
(this=0x5555568d6620) at 
/home/michi/development/git/libreoffice/comphelper/source/misc/asyncnotification.cxx:139
        #63 0x00007ffff6119165 in comphelper::AsyncEventNotifier::execute() 
(this=0x5555568d6620) at 
/home/michi/development/git/libreoffice/comphelper/source/misc/asyncnotification.cxx:156
        #64 0x00007ffff7d0f6ec in salhelper::Thread::run() 
(this=0x5555568d6630) at 
/home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
        #65 0x00007ffff7d0ff2e in threadFunc(void*) (param=0x5555568d6640) at 
include/osl/thread.hxx:189
        #66 0x00007ffff7fa4b2d in osl_thread_start_Impl(void*) 
(pData=0x55555ecc3e40) at 
/home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:237
        #67 0x00007ffff78a645c in start_thread (arg=<optimized out>) at 
./nptl/pthread_create.c:444
        #68 0x00007ffff7926bbc in clone3 () at 
../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
    
    Change-Id: I9e0b0d973997e3f4f50a9a31e9692325664fd262
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165995
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx
index 81ab7a7edc7b..b24b46b28a8d 100644
--- a/vcl/qt5/QtGraphics_Controls.cxx
+++ b/vcl/qt5/QtGraphics_Controls.cxx
@@ -25,6 +25,7 @@
 #include <QtWidgets/QLabel>
 #include <QtWidgets/QLineEdit>
 
+#include <QtInstance.hxx>
 #include <QtTools.hxx>
 #include <QtGraphicsBase.hxx>
 #include <vcl/decoview.hxx>
@@ -715,13 +716,23 @@ bool QtGraphics_Controls::drawNativeControl(ControlType 
type, ControlPart part,
     return returnVal;
 }
 
-bool QtGraphics_Controls::getNativeControlRegion(ControlType type, ControlPart 
part,
-                                                 const tools::Rectangle& 
controlRegion,
-                                                 ControlState controlState,
-                                                 const ImplControlValue& val, 
const OUString&,
-                                                 tools::Rectangle& 
nativeBoundingRegion,
-                                                 tools::Rectangle& 
nativeContentRegion)
+bool QtGraphics_Controls::getNativeControlRegion(
+    ControlType type, ControlPart part, const tools::Rectangle& controlRegion,
+    ControlState controlState, const ImplControlValue& val, const OUString& 
rCaption,
+    tools::Rectangle& nativeBoundingRegion, tools::Rectangle& 
nativeContentRegion)
 {
+    QtInstance* pQtInstance(GetQtInstance());
+    assert(pQtInstance);
+    if (!pQtInstance->IsMainThread())
+    {
+        bool bRet;
+        pQtInstance->RunInMainThread([&]() {
+            bRet = getNativeControlRegion(type, part, controlRegion, 
controlState, val, rCaption,
+                                          nativeBoundingRegion, 
nativeContentRegion);
+        });
+        return bRet;
+    }
+
     bool retVal = false;
 
     QRect boundingRect = toQRect(controlRegion);

Reply via email to