@@ -428,11 +428,14 @@ void java_bytecode_convert_methodt::convert(
428
428
id2string (class_symbol.name )+" ." +id2string (m.name )+" :" +m.descriptor ;
429
429
method_id=method_identifier;
430
430
431
- symbolt &method_symbol=*symbol_table.get_writeable (method_identifier);
432
-
433
431
// Obtain a std::vector of java_method_typet::parametert objects from the
434
432
// (function) type of the symbol
435
- java_method_typet method_type = to_java_method_type (method_symbol.type );
433
+ // Don't try to hang on to this reference into the symbol table, as we're
434
+ // about to create symbols for the method's parameters, which would invalidate
435
+ // the reference. Instead, copy the type here, set it up, then assign it back
436
+ // to the symbol later.
437
+ java_method_typet method_type =
438
+ to_java_method_type (symbol_table.lookup_ref (method_identifier).type );
436
439
method_type.set (ID_C_class, class_symbol.name );
437
440
method_type.set_is_final (m.is_final );
438
441
method_return_type = method_type.return_type ();
@@ -555,6 +558,8 @@ void java_bytecode_convert_methodt::convert(
555
558
param_index+=java_local_variable_slots (param.type ());
556
559
}
557
560
561
+ symbolt &method_symbol = symbol_table.get_writeable_ref (method_identifier);
562
+
558
563
// The parameter slots detected in this function should agree with what
559
564
// java_parameter_count() thinks about this method
560
565
INVARIANT (
0 commit comments