fix: creating a copy of signalstring

This commit is contained in:
Richard Ramos 2020-07-24 16:18:17 -04:00 committed by Michał
parent 0b41a9b86d
commit 7a286e548e
1 changed files with 2 additions and 1 deletions

View File

@ -766,7 +766,8 @@ bool dos_qurl_isValid(const ::DosQUrl *vptr)
void dos_signal(::DosQObject *vptr, const char *signal, const char *slot) //
{
auto qobject = static_cast<QObject *>(vptr);
QMetaObject::invokeMethod(qobject, slot, Qt::QueuedConnection, Q_ARG(QString, signal));
std::string copy = signal; // signal comes from nim, and might be GC. Creating a copy (QT will handle the freeing)
QMetaObject::invokeMethod(qobject, slot, Qt::QueuedConnection, Q_ARG(QString, copy.c_str()));
}
void dos_qmetaobject_delete(::DosQMetaObject *vptr)