Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix: Prevent crashes from tab switches due to Table Of Content #1246

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

ShaopengLin
Copy link
Collaborator

@ShaopengLin ShaopengLin commented Nov 13, 2024

Bug: Crashes can happen to the TOC management when the user switches tabs. Qt's QJsonObject copies are unreliable (though they shouldn't). I am uncertain as to why, but it appears references to the copied header array elements trigger segmentation faults. It also seems to be a race condition so in some cases it doesn't happen (when I tested it before merging it never occurred).

Fixes:

  • Pass the header array as a string and create our own copy of QJsonObject instead.
  • A nullptr guard was added to tableofcontentbar.cpp to prevent potential nullptr access. (This is irrelevant to the bug but something to carry over.)

Qt's WebChannel's signal JsonObject references are unreliable, so use QString for parsing. Also added guard against a potential nullptr access.
@ShaopengLin
Copy link
Collaborator Author

ShaopengLin commented Nov 13, 2024

@kelson42 @veloman-yunkan It would be great if we could get this tested and merged in ASAP. Though at least for me it doesn't always occur, it can be very frustrating for other devs.

@kelson42
Copy link
Collaborator

kelson42 commented Nov 13, 2024

@ShaopengLin aonce approved, I will merge and a new full testing round this WE.

@ShaopengLin
Copy link
Collaborator Author

Just another piece of info, this issue doesn't occur in Qt6.

@kelson42 kelson42 merged commit 1a0580d into main Nov 14, 2024
6 checks passed
@kelson42 kelson42 deleted the Bugfix-toc-switch-tab branch November 14, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants