mirror of
https://github.com/status-im/dotherside.git
synced 2025-02-11 20:16:47 +00:00
fix: improve defensive cstring copying
Intended to prevent Nim from inopportunely garbage collecting cstrings passed through signal_handler/dos_signal as they make their way back to the main thread
This commit is contained in:
parent
81ea295cc2
commit
25e70373f8
@ -864,8 +864,9 @@ bool dos_qurl_isValid(const ::DosQUrl *vptr)
|
|||||||
void dos_signal(::DosQObject *vptr, const char *signal, const char *slot) //
|
void dos_signal(::DosQObject *vptr, const char *signal, const char *slot) //
|
||||||
{
|
{
|
||||||
auto qobject = static_cast<QObject *>(vptr);
|
auto qobject = static_cast<QObject *>(vptr);
|
||||||
std::string copy = signal; // signal comes from nim, and might be GC. Creating a copy (QT will handle the freeing)
|
std::string signal_copy = signal;
|
||||||
QMetaObject::invokeMethod(qobject, slot, Qt::QueuedConnection, Q_ARG(QString, copy.c_str()));
|
std::string slot_copy = slot;
|
||||||
|
QMetaObject::invokeMethod(qobject, slot_copy.c_str(), Qt::QueuedConnection, Q_ARG(QString, signal_copy.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dos_qmetaobject_delete(::DosQMetaObject *vptr)
|
void dos_qmetaobject_delete(::DosQMetaObject *vptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user