diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index e6a61e1a5f2b..00b2c4841717 100644 --- a/src/google/protobuf/extension_set.cc +++ b/src/google/protobuf/extension_set.cc @@ -1092,10 +1092,8 @@ void ExtensionSet::InternalExtensionMergeFromIntoUninitializedExtension( case WireFormatLite::CPPTYPE_MESSAGE: { if (other_extension.is_lazy) { dst_extension.ptr.lazymessage_value = - other_extension.ptr.lazymessage_value->New(arena_); - dst_extension.ptr.lazymessage_value->MergeFrom( - GetPrototypeForLazyMessage(extendee, number), - *other_extension.ptr.lazymessage_value, arena_, other_arena); + other_extension.ptr.lazymessage_value->Clone( + arena_, *other_extension.ptr.lazymessage_value, other_arena); } else { dst_extension.ptr.message_value = other_extension.ptr.message_value->New(arena_); diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index 1a3b606055f4..e7e407b66c11 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -624,7 +624,9 @@ class PROTOBUF_EXPORT ExtensionSet { LazyMessageExtension& operator=(const LazyMessageExtension&) = delete; virtual ~LazyMessageExtension() = default; - virtual LazyMessageExtension* New(Arena* arena) const = 0; + virtual LazyMessageExtension* Clone(Arena* arena, + const LazyMessageExtension& other, + Arena* other_arena) const = 0; virtual const MessageLite& GetMessage(const MessageLite& prototype, Arena* arena) const = 0; virtual const MessageLite& GetMessageIgnoreUnparsed(