Skip to content

BugFix: ensure user windows closure when profile is closed if multi-playing#2597

Merged
SlySven merged 1 commit intoMudlet:developmentfrom
SlySven:BugFix_ensureUserWindowClosureWhenProfileIsClosedIfMultiPlaying
Jun 4, 2019
Merged

BugFix: ensure user windows closure when profile is closed if multi-playing#2597
SlySven merged 1 commit intoMudlet:developmentfrom
SlySven:BugFix_ensureUserWindowClosureWhenProfileIsClosedIfMultiPlaying

Conversation

@SlySven
Copy link
Copy Markdown
Member

@SlySven SlySven commented Jun 2, 2019

The previous code in (void) TConsole::closeEvent(QCloseEvent*) assumed the TConsole for a user window's objectName 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 objectName 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

…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>
@SlySven SlySven requested review from a team June 2, 2019 21:35
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Jun 2, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 2, 2019

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 TConsole::closeEvent(QCloseEvent*) INFO - closing a UserWindow but the TDockWidget pointer was not found to be removed... error message for every user window that was being closed in a profile as it was closed...

@SlySven SlySven merged commit b410017 into Mudlet:development Jun 4, 2019
@SlySven SlySven deleted the BugFix_ensureUserWindowClosureWhenProfileIsClosedIfMultiPlaying branch June 4, 2019 19:24
@SlySven SlySven restored the BugFix_ensureUserWindowClosureWhenProfileIsClosedIfMultiPlaying branch June 22, 2020 18:06
@SlySven SlySven deleted the BugFix_ensureUserWindowClosureWhenProfileIsClosedIfMultiPlaying branch June 22, 2020 19:02
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.

2 participants