summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-04-25 08:57:42 +0200
committerChris Sherlock <chris.sherlock79@gmail.com>2014-04-25 22:36:30 +1000
commitda7167a0e828f1c1079a99c98aa2831327f92674 (patch)
treed5b2541cfb6ba529c30e208dd806d383ffa3f4b9
parent9eab3e78b1f1927ee1ac2158a39ab22802779f92 (diff)
make sure KFileDialog does not leave the SolarMutex released
Change-Id: I806bf5fe1cd1871de499ceeeadf36de539e9d637
-rw-r--r--vcl/unx/kde4/KDE4FilePicker.cxx24
1 files changed, 10 insertions, 14 deletions
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index b92d86f155c9..5f121cce4b38 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -256,19 +256,17 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute()
_dialog->setFilter(_filter);
_dialog->filterWidget()->setEditable(false);
- // At this point, SolarMutex is held. Opening the KDE file dialog here
- // can lead to QClipboard asking for clipboard contents. If LO core
- // is the owner of the clipboard content, this will block for 5 seconds
- // and timeout, since the clipboard thread will not be able to acquire
- // SolarMutex and thus won't be able to respond. If the event loops
+ // KFileDialog intergration requires using event loop with QClipboard.
+ // Opening the KDE file dialog here can lead to QClipboard
+ // asking for clipboard contents. If LO core is the owner of the clipboard
+ // content, without event loop use this will block for 5 seconds and timeout,
+ // since the clipboard thread will not be able to acquire SolarMutex
+ // and thus won't be able to respond. If the event loops
// are properly integrated and QClipboard can use a nested event loop
- // (see the KDE VCL plug), then this won't happen, but otherwise
- // simply release the SolarMutex here. The KDE file dialog does not
- // call back to the core, so this should be safe (and if it does,
- // SolarMutex will need to be re-acquired).
- long mutexrelease = 0;
- if( !qApp->clipboard()->property( "useEventLoopWhenWaiting" ).toBool())
- mutexrelease = Application::ReleaseSolarMutex();
+ // (see the KDE VCL plug), then this won't happen.
+ // We cannot simply release SolarMutex here, because the event loop started
+ // by the file dialog would also call back to LO code.
+ assert( qApp->clipboard()->property( "useEventLoopWhenWaiting" ).toBool() == true );
//block and wait for user input
int result = _dialog->exec();
// HACK: KFileDialog uses KConfig("kdeglobals") for saving some settings
@@ -276,8 +274,6 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute()
// (which is probably a KDE bug), so force reading the new configuration,
// otherwise the next opening of the dialog would use the old settings.
KGlobal::config()->reparseConfiguration();
- if( !qApp->clipboard()->property( "useEventLoopWhenWaiting" ).toBool())
- Application::AcquireSolarMutex( mutexrelease );
if( result == KFileDialog::Accepted)
return ExecutableDialogResults::OK;