mirror of
https://github.com/status-im/dotherside.git
synced 2025-02-12 04:26:43 +00:00
More Changes for PR #31
This commit is contained in:
parent
cfb05fae25
commit
de7d2f02f6
@ -55,6 +55,9 @@ DOS_API void dos_qqmlcontext_setcontextproperty(void* vptr, const char* name, vo
|
||||
// CharArray
|
||||
DOS_API void dos_chararray_delete(char* ptr);
|
||||
|
||||
// QObjectPtrArray
|
||||
DOS_API void dos_qobjectptr_array_delete(void** ptr);
|
||||
|
||||
// QVariant
|
||||
DOS_API void dos_qvariant_create(void** vptr);
|
||||
DOS_API void dos_qvariant_create_int(void** vptr, int value);
|
||||
|
@ -110,10 +110,7 @@ void dos_qqmlapplicationengine_rootObjects(void* vptr, void*** array, int* array
|
||||
{
|
||||
QQmlApplicationEngine* engine = reinterpret_cast<QQmlApplicationEngine*>(vptr);
|
||||
QList<QObject*> list = engine->rootObjects();
|
||||
// Note: On fringe architectures where `8 < CHAR_BIT` this may not allocate enough memory,
|
||||
// as sizeof returns the number of chars required, while calloc/malloc expects
|
||||
// the number of octets required.
|
||||
QObject** objects = reinterpret_cast<QObject**>(calloc(list.length(), sizeof(QObject*)));
|
||||
auto objects = new QObject*[list.size()];
|
||||
if (objects == nullptr) return;
|
||||
for (int i = 0; i < list.length(); i += 1) objects[i] = list.at(i);
|
||||
*array = reinterpret_cast<void**>(objects);
|
||||
@ -180,6 +177,11 @@ void dos_chararray_delete(char* ptr)
|
||||
if (ptr) delete[] ptr;
|
||||
}
|
||||
|
||||
void dos_qobjectptr_array_delete(void** ptr)
|
||||
{
|
||||
if (ptr) delete[] ptr;
|
||||
}
|
||||
|
||||
void dos_qqmlcontext_baseUrl(void* vptr, char** result)
|
||||
{
|
||||
QQmlContext* context = reinterpret_cast<QQmlContext*>(vptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user