Solved Correct syntax to register object reference using qRegisterMetaType?
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@kshegunov , I am using const QJsonObject& for my signal arguments, these are working, the only thing that is displayed in the Application Output is the message I've raised. I'm not experience any other problems, crashes or bugs.
For the slots as well ?
-
@SGaist Of course.
-
Ok, I've now got rid of the warning, by going through all the QObject::connect calls and only using Qt::DirectionConnection where the signal and slot pointers are the same.
-
@SPlatten
A lot of your questions are about threads. Are yourconnect()
s' senders/receivers never in separate threads? -
@JonB , not for the ones where I've used Qt::DirectConnection
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
not for the ones where I've used Qt::DirectConnection
Then it's useless since then Qt::AutoConnection evaluates to Qt::DirectConnection. Specifying a connection type is not needed in most of the cases.
-
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
For that a minimal compilable example would be needed.
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
so perhaps this is something that needs looking at?
This means that there is a thread context switch somewhere even you tell us it isn't.
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
Run with
QT_FATAL_WARNINGS=1
as an environment variable and extract the stack trace, then you will have leveraged your debugger to show you exactly where you're passing a reference between threads. -
@kshegunov said in Correct syntax to register object reference using qRegisterMetaType?:
QT_FATAL_WARNINGS=1
I've opened both .pro files and added that line, then cleaned and rebuilt, the applications have been running for several minutes, nothing to report, no issues.
-
It's an environnement variable, not a define.
You have to set it in the Run tab of the Project panel.
-
@SGaist , Yes, just googled it and then added as environment variable:
export QT_FATAL_WARNINGS=1
Then restarted, same, not seeing anything additional.
-
Restarted what ?
How are you currently running your application ? -
@SGaist , I launch the processes with Qt Creator in debug mode, using two separate instances of Qt Creator.
-
Did you check the environment variables in the Run part of the Project Panel to ensure it's properly set ?
-
@SGaist , I checked in a terminal, I don't know how or where to "Run part of the Project Panel" ?
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
I don't know how or where to "Run part of the Project Panel" ?
Easy to find actually.
Left pane: Projects -> Build & Run -> Run... -
@jsulm , thank you, added it now, building now.