mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
Fix double delete of the Value in Struct::get_field
This commit is contained in:
parent
c6740fe592
commit
a3d0f3155d
2 changed files with 8 additions and 10 deletions
|
@ -185,13 +185,10 @@ public:
|
|||
|
||||
Type type() const { return cbindgen_private::sixtyfps_interpreter_value_type(&inner); }
|
||||
|
||||
// internal
|
||||
Value(const sixtyfps::cbindgen_private::ValueOpaque &inner) : inner(inner) { }
|
||||
|
||||
private:
|
||||
using ValueOpaque = sixtyfps::cbindgen_private::ValueOpaque;
|
||||
ValueOpaque inner;
|
||||
friend class Struct;
|
||||
friend struct Struct;
|
||||
};
|
||||
|
||||
inline Value::Value(const sixtyfps::SharedVector<Value> &array)
|
||||
|
@ -273,7 +270,7 @@ inline std::optional<Value> Struct::get_field(std::string_view name) const
|
|||
name.size()
|
||||
};
|
||||
if (auto *value = cbindgen_private::sixtyfps_interpreter_struct_get_field(&inner, name_view)) {
|
||||
return *value;
|
||||
return *reinterpret_cast<const Value *>(value);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
@ -287,4 +284,4 @@ inline void Struct::set_field(std::string_view name, const Value &value)
|
|||
cbindgen_private::sixtyfps_interpreter_struct_set_field(&inner, name_view, &value.inner);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue