basic/source/sbx/sbxvar.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d8428094c7f8b186b37c76fd7e9508a075424f80
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Thu Dec 23 20:04:30 2021 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Mon Dec 27 20:48:55 2021 +0100

    tdf#144353, tdf#146281 - Correctly copy the information about variables
    
    During the assignment of a variable, copy its information only if there
    isn't already one present.
    
    Change-Id: I29fcfcd10406f2af0708a879d57e0a3c704f179e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127387
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 8c5d6571feef..d2c9802c413b 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -282,7 +282,10 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
     {
         SbxValue::operator=( r );
         // tdf#144353 - copy information about a missing parameter. See 
SbiRuntime::SetIsMissing.
-        if (r.pInfo && !dynamic_cast<const SbxMethod*>(&r))
+        // We cannot unconditionally assign the data about a variable because 
we would overwrite
+        // the information about parameters (name, type, flags, and ids). For 
instance, in the case
+        // where a method will be initialized with a literal.
+        if (!pInfo)
             pInfo = r.pInfo;
         m_aDeclareClassName = r.m_aDeclareClassName;
         m_xComListener = r.m_xComListener;

Reply via email to