Fix: IRC crash when closing the profile#7294
Conversation
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
SlySven
left a comment
There was a problem hiding this comment.
I suspect this has come about because I cleaned up the profile closing code to delete and close dialogues like this IRC one - so the one in Host that points to this class now gets cleared by the same actions that cause this destructor to be run!
It might be a good ideal to convert the (Host*) mpHost to a QPointer<Host> mpHost (removing the then redundant nullptr initialisation in the header file) to ensure it is nulled if the Host class has gone away.
Of course since dlgIRC::slot_receiveMessage(...) is a slot it is being called asynchronously as the network code in a separate thread gets a message - and that was happening during profile closing to cause the crashing...
|
This is what this PR does: https://github.com/Mudlet/Mudlet/pull/7294/files#diff-10d784717a374c05586896b20bf54489d3a9acccead56c7cf1414118c574bb8eL132 Are you asking it to do something else? |
Still crashing for me. I tried the Win64 version, and the behaviour this time was different. Previously, when the "close profile" option was chosen, the mudlet profile console would close, and the IRC window would stay open briefly before the program crashed and the IRC window as well as the mudlet window would both close (because crash, of course). This time, when I chose "close profile" both the profile console and the irc window stayed open. The window for choosing a new profile to load pops up, and after a couple seconds, the entire program shuts down. |
|
I vaguely recall reading somewhere that suggested the order in which the signals associated with Ah, it was Qt4 and 5 and refers to
So it hasn't changed recently but perhaps we are tripping up on it anyway... |
|
@hungrybeagle once the updates have been rebuilt into this PR can you test it again and see if it still misbehaves as before? |
|
Will try. Most of my playing is on mac right now |
|
Ah, other changes to the development branch mean a further update/rebuild is needed... |
Is there a specific version I should try out? |
Seems to have been fixed with macOS on v4.18.5 |
|
Will try to test on PC soon |
src/dlgIRC.cpp
Outdated
| const QString from = message->nick(); | ||
| const QString to = getMessageTarget(message, buffer->title()); | ||
| mpHost->postIrcMessage(from, to, textToLua); | ||
| if (mpHost) { |
There was a problem hiding this comment.
Why not just combine the mpHost check as an AND with the other one within the condition of line 609?
There was a problem hiding this comment.
Added, though it's important to focus on things that actually matter. It helps PRs move quicker.
|
Awaiting your feedback on my comments @vadi2... |
Brief overview of PR changes/additions
Fixes Mudlet crash with IRC open when closing a profile
Motivation for adding to Mudlet
Mudlet should never crash
Other info (issues closed, discussion etc)
Closes #7293. I'll fix other cases of
Host* mpHost;after this PR so we have consistency in the codebase.Running the provided test case through AddressSanitizer revealed that mpHost was being used after it was deleted:
This helped pinpoint the cause of the crash.