From ee9c2392e47b6c3f46099639464ce2d1afb6fed2 Mon Sep 17 00:00:00 2001 From: zhangpeiyu Date: Wed, 16 Oct 2024 10:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E8=A7=84=E9=81=BFcpp=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protobuf-bitfun/src/google/protobuf/any_pb.ets | 4 ++++ protobuf-bitfun/src/google/protobuf/duration_pb.ets | 4 ++++ protobuf-bitfun/src/google/protobuf/empty_pb.ets | 4 ++++ protobuf-bitfun/src/google/protobuf/timestamp_pb.ets | 4 ++++ protobuf-bitfun/src/google/protobuf/wrappers_pb.ets | 4 ++++ protobuf-ets-main/protoc-gen-ets/src/typescript.ts | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/protobuf-bitfun/src/google/protobuf/any_pb.ets b/protobuf-bitfun/src/google/protobuf/any_pb.ets index b1fff4f..9559fdc 100644 --- a/protobuf-bitfun/src/google/protobuf/any_pb.ets +++ b/protobuf-bitfun/src/google/protobuf/any_pb.ets @@ -12,6 +12,10 @@ import { IMessageTypeRegistry } from '../../type-registry'; import collections from '@arkts.collections'; +{ + let _ = new collections.Array(); +} + @Sendable export class Any extends Message { /** diff --git a/protobuf-bitfun/src/google/protobuf/duration_pb.ets b/protobuf-bitfun/src/google/protobuf/duration_pb.ets index 24d1a05..90d2303 100644 --- a/protobuf-bitfun/src/google/protobuf/duration_pb.ets +++ b/protobuf-bitfun/src/google/protobuf/duration_pb.ets @@ -12,6 +12,10 @@ import { ProtoRuntime } from '../../private/proto-runtime'; import collections from "@arkts.collections"; +{ + let _ = new collections.Array(); +} + @Sendable export class Duration extends Message { /** diff --git a/protobuf-bitfun/src/google/protobuf/empty_pb.ets b/protobuf-bitfun/src/google/protobuf/empty_pb.ets index 6be3990..82dc98e 100644 --- a/protobuf-bitfun/src/google/protobuf/empty_pb.ets +++ b/protobuf-bitfun/src/google/protobuf/empty_pb.ets @@ -11,6 +11,10 @@ import { ProtoRuntime } from '../../private/proto-runtime'; import collections from "@arkts.collections"; +{ + let _ = new collections.Array(); +} + @Sendable export class Empty extends Message { constructor() { diff --git a/protobuf-bitfun/src/google/protobuf/timestamp_pb.ets b/protobuf-bitfun/src/google/protobuf/timestamp_pb.ets index e20242e..c1a223f 100644 --- a/protobuf-bitfun/src/google/protobuf/timestamp_pb.ets +++ b/protobuf-bitfun/src/google/protobuf/timestamp_pb.ets @@ -6,6 +6,10 @@ import { FieldWrapper } from '../../private/field-wrapper'; import { collections } from '@kit.ArkTS' import { ProtoRuntime } from '../../private/proto-runtime'; +{ + let _ = new collections.Array(); +} + @Sendable export class Timestamp extends Message { /** diff --git a/protobuf-bitfun/src/google/protobuf/wrappers_pb.ets b/protobuf-bitfun/src/google/protobuf/wrappers_pb.ets index ae9489e..ada647c 100644 --- a/protobuf-bitfun/src/google/protobuf/wrappers_pb.ets +++ b/protobuf-bitfun/src/google/protobuf/wrappers_pb.ets @@ -12,6 +12,10 @@ import { protoInt64 } from '../../proto-int64'; import collections from '@arkts.collections'; +{ + let _ = new collections.Array(); +} + @Sendable export class DoubleValue extends Message { /** diff --git a/protobuf-ets-main/protoc-gen-ets/src/typescript.ts b/protobuf-ets-main/protoc-gen-ets/src/typescript.ts index 45e0322..4e941f8 100644 --- a/protobuf-ets-main/protoc-gen-ets/src/typescript.ts +++ b/protobuf-ets-main/protoc-gen-ets/src/typescript.ts @@ -50,6 +50,10 @@ export function generateEts(schema: Schema) { const f = schema.generateFile(file.name + "_pb.ts"); f.print(`import collections from "@arkts.collections"`) f.print(); + f.print('{'); + f.print(' let _ = new collections.Array();'); + f.print('}'); + f.print(); for (const enumeration of file.enums) { generateEnum(schema, f, enumeration); } -- Gitee