Skip to content

FIX(client): Specify version when loading/saving MainWindow state - #6584

Merged
davidebeatrici merged 2 commits into
mumble-voip:masterfrom
davidebeatrici:mainwindow-state-version
Nov 9, 2024
Merged

davidebeatrici merged 2 commits into
mumble-voip:masterfrom
davidebeatrici:mainwindow-state-version

Conversation

@davidebeatrici

Copy link
Copy Markdown
Member

This fixes a crash caused by the state being incompatible between Qt 5 and 6.

Please note that the default argument value for restoreState() is 0: https://doc.qt.io/qt-6/qmainwindow.html#restoreState

Comment thread src/mumble/MainWindow.cpp Resolved
@Krzmbrzl

Krzmbrzl commented Oct 1, 2024 •

Copy link
Copy Markdown
Member

I would go a step further and compute a hash from the MainWindow.ui file, combine that with the Qt version and then use that as the version in the save and restore commands. That means that any change to the MainWindow should change the version, which is likely handy should we add or remove certain UI elements from it.

The hashing could be done by cmake and then be passed to the code as a macro.

@davidebeatrici

Copy link
Copy Markdown
Member Author

compute a hash from the MainWindow.ui function

You mean hashing the file itself?

@Krzmbrzl

Krzmbrzl commented Oct 1, 2024

Copy link
Copy Markdown
Member

Yes, exactly. Such that the hash changes every time we change the UI file.

@davidebeatrici
davidebeatrici force-pushed the mainwindow-state-version branch from e6a2de7 to e213a06 Compare October 5, 2024 02:42
@davidebeatrici davidebeatrici changed the title FIX(client): Bump MainWindow state version to 1 for Qt 6 FIX(client): Specify version when loading/saving MainWindow state Oct 5, 2024
Comment thread src/mumble/CMakeLists.txt Resolved
Comment thread src/mumble/MainWindow.cpp Resolved
Comment thread src/mumble/MainWindow.cpp Resolved
Comment thread src/mumble/MainWindow.cpp Resolved
Comment thread src/mumble/MainWindow.h Resolved
Comment thread src/mumble/MainWindow.cpp Resolved
This fixes a crash caused by the state being incompatible between Qt 5 and 6.

Also, by having MainWindow.ui's hash as part of the version seed we can avoid
potential bugs/glitches that may arise when MainWindow's widgets are changed.
@davidebeatrici
davidebeatrici force-pushed the mainwindow-state-version branch from e213a06 to 0a03d4e Compare October 6, 2024 02:59
@Hartmnt Hartmnt added client bug A bug (error) in the software qt auto-backport-to-1.5.x labels Oct 14, 2024

@Hartmnt Hartmnt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I did not test it though.

@Krzmbrzl

Krzmbrzl commented Nov 9, 2024

Copy link
Copy Markdown
Member

💚 All backports created successfully

Status Branch Result
✅ 1.5.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash due to attempting to restore incompatible window state

3 participants