summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-07 11:24:18 +0200
committerDavid Tardon <dtardon@redhat.com>2014-08-07 12:50:55 +0000
commitcddfd33a3bea009394ec2b5c1cb94d09d8c40b23 (patch)
tree6d2ad4268232f2b804facc07078beb1d07e8d2f7 /sfx2
parent47cb8a41ffe7221814307ad72e58bdc735c1812c (diff)
rhbz#1079672: FileDialogHelper: don't hand out stale preview Graphic
The maGraphic is updated from a timer, and if you double-click on a file then the dialog may exit with the previous file still previewed in maGraphic, so the wrong image is returned by the dialog. Change-Id: I99094d85d8d68d5c8a842f52e7039dbbbf095995 (cherry picked from commit f1589f768bbd1d8baea6e442f392831851bdbb3b) Reviewed-on: https://gerrit.libreoffice.org/10802 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index c04ae90ecd13..78a14ee67826 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -789,23 +789,20 @@ ErrCode FileDialogHelper_Impl::getGraphic( Graphic& rGraphic ) const
{
ErrCode nRet = ERRCODE_NONE;
- if ( ! maGraphic )
- {
- OUString aPath;;
- Sequence < OUString > aPathSeq = mxFileDlg->getFiles();
+ // rhbz#1079672 do not return maGraphic, it need not be the selected file
- if ( aPathSeq.getLength() == 1 )
- {
- aPath = aPathSeq[0];
- }
+ OUString aPath;;
+ Sequence<OUString> aPathSeq = mxFileDlg->getFiles();
- if ( !aPath.isEmpty() )
- nRet = getGraphic( aPath, rGraphic );
- else
- nRet = ERRCODE_IO_GENERAL;
+ if (aPathSeq.getLength() == 1)
+ {
+ aPath = aPathSeq[0];
}
+
+ if (!aPath.isEmpty())
+ nRet = getGraphic(aPath, rGraphic);
else
- rGraphic = maGraphic;
+ nRet = ERRCODE_IO_GENERAL;
return nRet;
}