Kaydet (Commit) 474ad6b0 authored tarafından Luboš Luňák's avatar Luboš Luňák

make sure KFileDialog does not leave the SolarMutex released

Change-Id: I806bf5fe1cd1871de499ceeeadf36de539e9d637
üst 2cd8a1e0
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment