diff options
author | David Ostrovsky <david@ostrovsky.org> | 2015-02-03 10:41:32 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-02-03 17:03:28 +0000 |
commit | 60a64d1807b075fb630774adf950612d71734171 (patch) | |
tree | ecd0f4bf2f15a274c429002e00c01a87e67a32c3 | |
parent | 6143a7eeabea394133c54e97e3690bdf40b98247 (diff) |
climaker: Fix handling incomplete types
The order in which the hash table of incomplete structure types is
iterated is non-deterministic. Make sure that the array fields are
complete types before they are assigned.
This fixed weird error on Windows 64 bit. The reason this bug wasn't
hitting on 32 bit Windows build is because the generation order was
different and by chance the referenced fields were already generated.
Change-Id: Ifc8622b420fc25fea5a0ac8c09d08f7804c9b77c
Reviewed-on: https://gerrit.libreoffice.org/13851
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | cli_ure/source/climaker/climaker_emit.cxx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx index ee7e2c944b9f..6f0de95707d8 100644 --- a/cli_ure/source/climaker/climaker_emit.cxx +++ b/cli_ure/source/climaker/climaker_emit.cxx @@ -1268,8 +1268,19 @@ Assembly ^ TypeEmitter::type_resolve( } else { - field_type = - get_type( pseq_members[ member_pos ] ); + field_type = get_type( pseq_members[ member_pos ] ); + + if (field_type->IsArray + && m_incomplete_structs[cts_name] + && !field_type->Namespace->Equals("System")) + { + //Find the value type. In case of sequence<sequence< ... > > find the actual value type + ::System::Type ^ value = field_type; + while ((value = value->GetElementType())->IsArray); + //If the value type is a struct then make sure it is fully created. + get_complete_struct(value->FullName); + field_type = get_type(pseq_members[member_pos]); + } } members[ member_pos ] = entry->m_type_builder->DefineField( @@ -1340,12 +1351,6 @@ Assembly ^ TypeEmitter::type_resolve( } else if (field_type->IsArray) { - //Find the value type. In case of sequence<sequence< ... > > find the actual value type - ::System::Type ^ value = field_type; - while ((value = value->GetElementType())->IsArray); - //If the value type is a struct then make sure it is fully created. - get_complete_struct(value->FullName); - code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Ldc_I4_0 ); code->Emit( |