mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
C++ Make the stron_ref and weak_ref of VRc atomic
To match the equivalent in rust
This commit is contained in:
parent
9b869f2dc0
commit
7cc13d78c3
1 changed files with 3 additions and 2 deletions
|
@ -13,6 +13,7 @@ LICENSE END */
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
namespace vtable {
|
namespace vtable {
|
||||||
|
|
||||||
|
@ -67,8 +68,8 @@ struct VRcInner {
|
||||||
private:
|
private:
|
||||||
VRcInner() : layout {} {}
|
VRcInner() : layout {} {}
|
||||||
const VTable *vtable = &X::static_vtable;
|
const VTable *vtable = &X::static_vtable;
|
||||||
int strong_ref = 1;
|
std::atomic<int> strong_ref = 1;
|
||||||
int weak_ref = 1;
|
std::atomic<int> weak_ref = 1;
|
||||||
std::uint16_t data_offset = offsetof(VRcInner, data);
|
std::uint16_t data_offset = offsetof(VRcInner, data);
|
||||||
union {
|
union {
|
||||||
X data;
|
X data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue