update dev300-m58
[ooovba.git] / applied_patches / 0295-fpicker-kde-less-threads.diff
bloba05543256c349cae8b3e862df98c1d0ac4ad5075
1 diff --git fpicker/source/unx/kde_unx/UnxCommandThread.hxx fpicker/source/unx/kde_unx/UnxCommandThread.hxx
2 index d20321e..5fd62ee 100644
3 --- fpicker/source/unx/kde_unx/UnxCommandThread.hxx
4 +++ fpicker/source/unx/kde_unx/UnxCommandThread.hxx
5 @@ -86,10 +86,50 @@
6 #include <rtl/ustring.hxx>
7 #endif
9 +#include <vcl/svapp.hxx>
11 #include <list>
13 class UnxFilePickerNotifyThread;
15 +/** Synchronization for the 'thread-less' version of the fpicker.
17 + Something like osl::Condition, but calls Application::Yield() while in
18 + wait().
19 +*/
20 +class YieldingCondition
22 + ::osl::Mutex m_aMutex;
23 + bool m_bValue;
25 + bool get()
26 + {
27 + ::osl::MutexGuard aGuard( m_aMutex );
28 + return m_bValue;
29 + }
31 +public:
32 + YieldingCondition() { reset(); }
34 + void reset()
35 + {
36 + ::osl::MutexGuard aGuard( m_aMutex );
37 + m_bValue = false;
38 + }
40 + void set()
41 + {
42 + ::osl::MutexGuard aGuard( m_aMutex );
43 + m_bValue = true;
44 + }
46 + void wait()
47 + {
48 + while ( !get() )
49 + Application::Yield();
50 + }
51 +};
53 class UnxFilePickerCommandThread : public ::osl::Thread
55 protected:
56 @@ -98,7 +138,7 @@ protected:
58 ::osl::Mutex m_aMutex;
60 - ::osl::Condition m_aExecCondition;
61 + YieldingCondition m_aExecCondition;
62 sal_Bool m_aResult;
64 ::osl::Condition m_aGetCurrentFilterCondition;
65 @@ -117,7 +157,7 @@ public:
66 UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD );
67 ~UnxFilePickerCommandThread();
69 - ::osl::Condition& SAL_CALL execCondition() { return m_aExecCondition; }
70 + YieldingCondition& SAL_CALL execCondition() { return m_aExecCondition; }
71 sal_Bool SAL_CALL result();
73 ::osl::Condition& SAL_CALL getCurrentFilterCondition() { return m_aGetCurrentFilterCondition; }
74 diff --git fpicker/source/unx/kde_unx/UnxFilePicker.cxx fpicker/source/unx/kde_unx/UnxFilePicker.cxx
75 index 4590b74..16b2367 100644
76 --- fpicker/source/unx/kde_unx/UnxFilePicker.cxx
77 +++ fpicker/source/unx/kde_unx/UnxFilePicker.cxx
78 @@ -258,8 +258,12 @@ sal_Int16 SAL_CALL UnxFilePicker::execute()
80 checkFilePicker();
82 - sendCommand( ::rtl::OUString::createFromAscii( "exec" ),
83 - m_pCommandThread->execCondition() );
84 + // this is _not_ an osl::Condition, see i#93366
85 + m_pCommandThread->execCondition().reset();
87 + sendCommand( ::rtl::OUString::createFromAscii( "exec" ) );
89 + m_pCommandThread->execCondition().wait();
91 return m_pCommandThread->result();