c2deef3
From e1b57d025b0523479fe906f050c5639ad280b481 Mon Sep 17 00:00:00 2001
c2deef3
From: Michael Stahl <mstahl@redhat.com>
c2deef3
Date: Thu, 7 Aug 2014 11:24:18 +0200
c2deef3
Subject: [PATCH] rhbz#1079672: FileDialogHelper: don't hand out stale preview
c2deef3
 Graphic
c2deef3
c2deef3
The maGraphic is updated from a timer, and if you double-click on a file
c2deef3
then the dialog may exit with the previous file still previewed in
c2deef3
maGraphic, so the wrong image is returned by the dialog.
c2deef3
c2deef3
Change-Id: I99094d85d8d68d5c8a842f52e7039dbbbf095995
c2deef3
(cherry picked from commit f1589f768bbd1d8baea6e442f392831851bdbb3b)
c2deef3
Reviewed-on: https://gerrit.libreoffice.org/10804
c2deef3
Reviewed-by: David Tardon <dtardon@redhat.com>
c2deef3
Tested-by: David Tardon <dtardon@redhat.com>
c2deef3
---
c2deef3
 sfx2/source/dialog/filedlghelper.cxx | 23 ++++++++++-------------
c2deef3
 1 file changed, 10 insertions(+), 13 deletions(-)
c2deef3
c2deef3
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
c2deef3
index c8178a4..28a8060 100644
c2deef3
--- a/sfx2/source/dialog/filedlghelper.cxx
c2deef3
+++ b/sfx2/source/dialog/filedlghelper.cxx
c2deef3
@@ -789,23 +789,20 @@ ErrCode FileDialogHelper_Impl::getGraphic( Graphic& rGraphic ) const
c2deef3
 {
c2deef3
     ErrCode nRet = ERRCODE_NONE;
c2deef3
 
c2deef3
-    if ( ! maGraphic )
c2deef3
-    {
c2deef3
-        OUString aPath;;
c2deef3
-        Sequence < OUString > aPathSeq = mxFileDlg->getFiles();
c2deef3
+    // rhbz#1079672 do not return maGraphic, it need not be the selected file
c2deef3
 
c2deef3
-        if ( aPathSeq.getLength() == 1 )
c2deef3
-        {
c2deef3
-            aPath = aPathSeq[0];
c2deef3
-        }
c2deef3
+    OUString aPath;;
c2deef3
+    Sequence<OUString> aPathSeq = mxFileDlg->getFiles();
c2deef3
 
c2deef3
-        if ( !aPath.isEmpty() )
c2deef3
-            nRet = getGraphic( aPath, rGraphic );
c2deef3
-        else
c2deef3
-            nRet = ERRCODE_IO_GENERAL;
c2deef3
+    if (aPathSeq.getLength() == 1)
c2deef3
+    {
c2deef3
+        aPath = aPathSeq[0];
c2deef3
     }
c2deef3
+
c2deef3
+    if (!aPath.isEmpty())
c2deef3
+        nRet = getGraphic(aPath, rGraphic);
c2deef3
     else
c2deef3
-        rGraphic = maGraphic;
c2deef3
+        nRet = ERRCODE_IO_GENERAL;
c2deef3
 
c2deef3
     return nRet;
c2deef3
 }
c2deef3
-- 
c2deef3
1.9.3
c2deef3