Kaydet (Commit) ed4791eb authored tarafından Michael Stahl's avatar Michael Stahl

svx: convert some horrible code to SolarMutexTryAndBuyGuard

Try to preserve the existing spin-lock insanity as-is.

Change-Id: Ic98aa33d2e56536856892fcf61de672952101ae1
üst 42314253
...@@ -3545,23 +3545,16 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId, const PropertyChangeEvent ...@@ -3545,23 +3545,16 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId, const PropertyChangeEvent
DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL;
if (pColumn) if (pColumn)
{ {
bool bAcquiredPaintSafety = false; boost::scoped_ptr<vcl::SolarMutexTryAndBuyGuard> pGuard;
while (!m_bWantDestruction && !bAcquiredPaintSafety) while (!m_bWantDestruction && (!pGuard || !pGuard->isAcquired()))
bAcquiredPaintSafety = Application::GetSolarMutex().tryToAcquire(); pGuard.reset(new vcl::SolarMutexTryAndBuyGuard);
if (m_bWantDestruction) if (m_bWantDestruction)
{ // at this moment, within another thread, our destructor tries to destroy the listener which called this method { // at this moment, within another thread, our destructor tries to destroy the listener which called this method
// => don't do anything // => don't do anything
// 73365 - 23.02.00 - FS // 73365 - 23.02.00 - FS
if (bAcquiredPaintSafety)
// though the above while-loop suggests that (m_bWantDestruction && bAcquiredPaintSafety) is impossible,
// it isnt't, as m_bWantDestruction isn't protected with any mutex
Application::GetSolarMutex().release();
return; return;
} }
// here we got the solar mutex, transfer it to a guard for safety reasons
SolarMutexGuard aPaintSafety;
Application::GetSolarMutex().release();
// and finally do the update ... // and finally do the update ...
pColumn->UpdateFromField(m_xCurrentRow, m_xFormatter); pColumn->UpdateFromField(m_xCurrentRow, m_xFormatter);
......
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