Fix problems with Composer window closing#3386
Conversation
Fix createLabel (..., true) (Mudlet#3384)
* Added closeEvent to Composer window which clears pointer to itself in cTelnet when it gets closed without pushing save/cancel (such as clicking X or right-click and close) * Added to cTelnet destructor saying to close Composer window
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
|
👍 fixes look good to me - will test when I can. Not enough time to make it into this release with testing, but it should be good for the next one. |
|
Can I make the observation that a quicker and simpler method would be to change the line in dlgComposer* mpComposer;to: QPointer<dlgComposer> mpComposer;We already do that for some other dialogue pointers - for the same reason...! If you do that instead then you do not need any code in
|
* Update dlgComposer.h * Update dlgComposer.cpp * Update ctelnet.cpp * Update ctelnet.h * Update dlgComposer.cpp
* Update ctelnet.cpp * Update ctelnet.cpp
|
That all sounds good. It took me a while to figure out why that didn't work. Turns out the close function was not getting rid of it and needed a flag to do so. Now I'm able to close it and open it again, and also close the profile with it open with no problem. |
|
Thanks a lot for the fix, @atari2600tim! Looking forward to more :) |
* fix segfault with Composer window being left open * Added closeEvent to Composer window which clears pointer to itself in cTelnet when it gets closed without pushing save/cancel (such as clicking X or right-click and close) * Added to cTelnet destructor saying to close Composer window * Use QPointer and set flag to delete on close (Mudlet#8) * Update dlgComposer.h * Update dlgComposer.cpp * Update ctelnet.cpp * Update ctelnet.h * Update dlgComposer.cpp * missed part (Mudlet#9) * Update ctelnet.cpp * Update ctelnet.cpp
Brief overview of PR changes/additions
Motivation for adding to Mudlet
Allows you to open an editor window again after closing an earlier editor window by clicking the X instead of cancel/save. Avoids segfault that currently happens if you click cancel on the composer window after closing the profile that it was associated with.
Other info (issues closed, discussion etc)
This should solve issue #3300
In addition to not being able to open a new editor after closing it, there is also problem where if you leave the composer window open and close your profile then the window is still there and crashes mudlet if you push button to save or cancel, should solve that too.