Skip to content

Commit

Permalink
Prevent ByteArray and UtfString from being prematurely cleaned up (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
austinh0 authored Nov 30, 2021
1 parent 3958429 commit a9ffa78
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 36 deletions.
6 changes: 4 additions & 2 deletions src/controller/java/templates/partials/decode_value.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ if ({{source}}.Value().IsNull()) {
{{else if isStruct}}
{{asSymbol label}} = nullptr; /* Struct - conversion from this type to Java is not properly implemented yet */
{{else if (isOctetString type)}}
{{target}} = chip::ByteArray(env, {{>item}}).jniValue();
chip::ByteArray {{target}}ByteArray(env, {{>item}});
{{target}} = {{target}}ByteArray.jniValue();
{{else if (isCharString type)}}
{{target}} = chip::UtfString(env, {{>item}}).jniValue();
chip::UtfString {{target}}UtfString(env, {{>item}});
{{target}} = {{target}}UtfString.jniValue();
{{else}}
std::string {{target}}ClassName = "java/lang/{{asJavaBasicTypeForZclType type true}}";
std::string {{target}}CtorSignature = "({{asJniSignature type false}})V";
Expand Down
96 changes: 64 additions & 32 deletions src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/controller/java/zap-generated/CHIPReadCallbacks.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9ffa78

Please sign in to comment.