Conversation
Change SerialBusConnection's timer from a value member to a lazily allocated QObject child created on first piStarted(). The base CANConnection constructor may move the connection object to its worker thread before derived members are constructed. Under Qt6 this causes cross-thread QObject child creation and timer start errors when QTimer is parented during SerialBusConnection construction. Create and start the timer only after the connection is running in its worker thread.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please review
This fixes for me the following:
QObject: Cannot create children for a parent that is in a different thread.
(Parent is SerialBusConnection(0xf5738b0), parent's thread is QThread(0xf5c6cd0), current thread is QThread(0xee624e0)
QObject::startTimer: Timers cannot be started from another thread
Otherwise, no serial connection establishes / works - e.g. my case, passthrucan . If warnings as critical enabled, qt will abort and app dumps core.
With the change, i can use passthrucan and it loads my j2534.so.