Fix build against macOS deployment target 10.10

- std::optional<T>::value() is not available, use operator * instead
- alignment allocation is also only available in 10.14 or newer
This commit is contained in:
Simon Hausmann 2023-04-24 17:29:41 +02:00 committed by Simon Hausmann
parent 18253b5150
commit 0ba6ef1c24
4 changed files with 14 additions and 4 deletions

View file

@ -147,7 +147,7 @@ public:
template<typename Component>
void set_component(const Component &c) const
{
auto self_rc = c.self_weak.lock().value().into_dyn();
auto self_rc = (*c.self_weak.lock()).into_dyn();
slint_windowrc_set_component(&inner, &self_rc);
}
@ -289,8 +289,10 @@ inline void dealloc(const ComponentVTable *, uint8_t *ptr, vtable::Layout layout
#ifdef __cpp_sized_deallocation
::operator delete(reinterpret_cast<void *>(ptr), layout.size,
static_cast<std::align_val_t>(layout.align));
#else
#elif !defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14
::operator delete(reinterpret_cast<void *>(ptr), static_cast<std::align_val_t>(layout.align));
#else
::operator delete(reinterpret_cast<void *>(ptr));
#endif
}