[Libreoffice-commits] core.git: vcl/unx

Milian Wolff milian.wolff at kdab.com
Tue Jan 30 20:01:48 UTC 2018


 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx |   35 ++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 53e414df4af125ccc9b9dd96b7212f2fef7b7de2
Author: Milian Wolff <milian.wolff at kdab.com>
Date:   Tue Jan 30 11:16:00 2018 +0100

    Fix compilation with GCC 4.8
    
    Workaround a bug in variadic template parameter pack expansion in
    lambdas that affects GCC 4.8. The workaround expands the pack outside
    the lambda into a custom functor that then calls readIpcArgs.
    
    Change-Id: I7a2d8572a6f2b330bb22a4f18f5cc13fd7ef9b45
    Reviewed-on: https://gerrit.libreoffice.org/48895
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
index bed1ae113823..3e97eebbb0c1 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
@@ -71,10 +71,43 @@ public:
 
     std::string readResponseLine();
 
+    // workaround gcc <= 4.8 bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55914
+    template <int...> struct seq
+    {
+    };
+    template <int N, int... S> struct gens : gens<N - 1, N - 1, S...>
+    {
+    };
+    template <int... S> struct gens<0, S...>
+    {
+        typedef seq<S...> type;
+    };
+    template <typename... Args> struct ArgsReader
+    {
+        ArgsReader(Args&... args)
+            : m_args(args...)
+        {
+        }
+
+        void operator()(std::istream& stream)
+        {
+            callFunc(stream, typename gens<sizeof...(Args)>::type());
+        }
+
+    private:
+        template <int... S> void callFunc(std::istream& stream, seq<S...>)
+        {
+            readIpcArgs(stream, std::get<S>(m_args)...);
+        }
+
+        std::tuple<Args&...> m_args;
+    };
+
     template <typename... Args> void readResponse(uint64_t id, Args&... args)
     {
         // read synchronously from a background thread and run the eventloop until the value becomes available
         // this allows us to keep the GUI responsive and also enables access to the LO clipboard
+        ArgsReader<Args...> argsReader(args...);
         await(std::async(std::launch::async, [&]() {
             while (true)
             {
@@ -92,7 +125,7 @@ public:
                 if (m_incomingResponse == id)
                 {
                     // the response we are waiting for came in
-                    readIpcArgs(m_responseStream, args...);
+                    argsReader(m_responseStream);
                     m_incomingResponse = 0;
                     break;
                 }


More information about the Libreoffice-commits mailing list