Hi,

could you please review the attached patch for libreoffice-3-3 branch? 

It looks like a compiler bug. I see it only on SLED11 with one
particular gcc version. So, the solution is a kind of workaround but
it should be fine in general. See the patch for more details.


Best Regards,
Petr
>From ae47cb905e64ecdcf33bcf26cf8805b3e410a494 Mon Sep 17 00:00:00 2001
From: Petr Mladek <pmla...@suse.cz>
Date: Thu, 13 Jan 2011 21:13:19 +0100
Subject: [PATCH] unopkg crasher on SLED11-SP1 (bnc#655912)

activateExtension call broke memory if dp_misc::getIdentifier and xNewExtension
were called inline; the problem was visible only with gcc-4.3.4 and did not
appear with older or newer gcc versions

valgrind got happy and unopkg stopped crashing after the values were passed via
the extra variables

it looks like a miscompilation; IMHO, it does not make sense to report it
because it does not happen with last gcc version

this code is not critical for the performance, so the workaround with
extra variables is fine; they might even be optimized out by the compiler
---
 .../deployment/manager/dp_extensionmanager.cxx     |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index c6529ec..56d95a6 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -740,9 +740,19 @@ Reference<deploy::XPackage> ExtensionManager::addExtension(
                     if (repository.equals(OUSTR("user")))
                         bUserDisabled2 = false;
 
+                    // FIXME: activateExtension call broke memory if dp_misc::getIdentifier and xNewExtension
+                    // were called inline; the problem was visible only with gcc-4.3.4 and did not appear
+                    // with older or newer gcc versions; valgrind got happy and unopkg stopped crashing
+                    // after the values were passed via the extra variables
+                    // it looks like a miscompilation; it does not make sense to report it
+                    // because it does not happen with last gcc version; this code is not critical
+                    // for the performance, so this workaround is fine
+                    OUString sNewExtensionIdentifier = dp_misc::getIdentifier(xNewExtension);
+                    OUString sNewExtensionFileName = xNewExtension->getName();
+
                     activateExtension(
-                        dp_misc::getIdentifier(xNewExtension),
-                        xNewExtension->getName(), bUserDisabled2, false, xAbortChannel,
+                        sNewExtensionIdentifier, sNewExtensionFileName,
+                        bUserDisabled2, false, xAbortChannel,
                         Reference<ucb::XCommandEnvironment>());
                 }
                 else
-- 
1.7.3.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to