summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-12-23 20:04:30 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-10 09:20:16 +0100
commit1a343e3168c6ac8acf3279307275727e588ddcb7 (patch)
tree0c00c61014c284602bfaac58eae5f98fed3565f1
parent8cd54309baa9ad4e28d5c1e16ba8684de8af257e (diff)
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.heinisch@yahoo.de> (cherry picked from commit d8428094c7f8b186b37c76fd7e9508a075424f80) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129752 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--basic/source/sbx/sbxvar.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index b8be36ec2735..6097d25eb995 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -281,7 +281,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;