BugFix: ensure user windows closure when profile is closed if multi-playing#2597
Merged
SlySven merged 1 commit intoMudlet:developmentfrom Jun 4, 2019
Conversation
…laying The previous code in `(void) TConsole::closeEvent(QCloseEvent*)` assumed the `TConsole` for a user window's object name was what was used as a key in the profile's main `TConsole`'s `<QString, TConsole*> mSubConsoleMap` and `<QString, TDockWidget*> mDockWidgetMap`. In fact for user windows the object name was never set for the `TConsole` and it would not be a good thing to have both the TDockWidget and the TConsole have the same object name anyhow. To further confuse things, the process of constructing the `TConsole` for a user window did not set a `(QString) mConsoleName` so the default of "main" was set for that member. This PR revises the design so that the `TConsole::closeEvent` DOES find the wanted item in the main `TConsole`'s mSubConsoleMap and mDockWidgetMap so that the `(TTextEdit*) mUpperPane` and `mLowerPane` DO get the `close()` method called on them - and there is no error message: "TConsole::closeEvent(QCloseEvent*) INFO - closing a UserWindow but the TDockWidget pointer was not found to be removed..." produced for every user window that is closed when a profile is ended but the Mudlet application continues to run when multi-playing... Also: * A shadowed pair of `TDockWidget` and `TConsole` pointers are no longer created in `(bool) mudlet::openWindow(...)` by spurious uses of `auto` (when there are already a pair of `pD` and `pC` in existence). * Some uses of raw strings or `QString` constructions for `objectName` are cleaned up to use `QStringLiteral` constructions instead. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
Member
Author
|
I found this bug whilst investigation an issue I was having with closing and then reopening a profile whilst multiple profiles were active - I was getting a |
vadi2
approved these changes
Jun 3, 2019
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.
The previous code in
(void) TConsole::closeEvent(QCloseEvent*)assumed theTConsolefor a user window'sobjectNamewas what was used as a key in the profile's mainTConsole's<QString, TConsole*> mSubConsoleMapand<QString, TDockWidget*> mDockWidgetMap.In fact for user windows the object name was never set for the
TConsoleand it would not be a good thing to have both theTDockWidgetand theTConsolehave the sameobjectNameanyhow. To further confuse things, the process of constructing theTConsolefor a user window did not set a(QString) mConsoleNameso the default of"main"was set for that member.This PR revises the design so that the
TConsole::closeEventDOES find the wanted item in the mainTConsole'smSubConsoleMapandmDockWidgetMapso that the(TTextEdit*) mUpperPaneandmLowerPaneDO get theclose()method called on them - and there is no error message:"TConsole::closeEvent(QCloseEvent*) INFO - closing a UserWindow but the TDockWidget pointer was not found to be removed..."produced for every user window that is closed when a profile is ended but the Mudlet application continues to run when multi-playing...Also:
TDockWidgetandTConsolepointers are no longer created in(bool) mudlet::openWindow(...)by spurious uses ofauto(when there are already a pair ofpDandpCin existence).QStringconstructions forobjectNameare cleaned up to useQStringLiteralconstructions instead.Signed-off-by: Stephen Lyons slysven@virginmedia.com