summaryrefslogtreecommitdiff
path: root/fpicker/source/win32/VistaFilePickerImpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'fpicker/source/win32/VistaFilePickerImpl.cxx')
-rw-r--r--fpicker/source/win32/VistaFilePickerImpl.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx
index 3c3286fe2f14..941a8c64d44c 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -187,10 +187,10 @@ VistaFilePickerImpl::VistaFilePickerImpl()
, m_iEventHandler(new VistaFilePickerEventHandler(this))
, m_bInExecute (false)
, m_bWasExecuted (false)
+ , m_hParentWindow(nullptr)
, m_sDirectory ()
, m_sFilename ()
{
- m_hParentWindow = choose_parent_window();
}
@@ -1026,19 +1026,25 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
}
}
-
HRESULT hResult = E_FAIL;
+ HWND hParentWindow;
+ {
+ osl::MutexGuard aLock(m_aMutex);
+ // Note that there is a potential race between retrieving and
+ // using parent window (window might get destroyed)
+ hParentWindow = m_hParentWindow ? m_hParentWindow : choose_parent_window();
+ }
try
{
// show dialog and wait for user decision
if (iOpen.is())
- hResult = iOpen->Show( m_hParentWindow ); // parent window needed
+ hResult = iOpen->Show( hParentWindow ); // parent window needed
else
if (iSave.is())
- hResult = iSave->Show( m_hParentWindow ); // parent window needed
+ hResult = iSave->Show( hParentWindow ); // parent window needed
else
if (iPick.is())
- hResult = iPick->Show( m_hParentWindow ); // parent window needed
+ hResult = iPick->Show( hParentWindow ); // parent window needed
}
catch(...)
{}