Skip to content

fix for closing Composer window#2

Merged
atari2600tim merged 5 commits intocloseComposerfrom
closeComposer-temp
Mar 5, 2020
Merged

fix for closing Composer window#2
atari2600tim merged 5 commits intocloseComposerfrom
closeComposer-temp

Conversation

@atari2600tim
Copy link
Copy Markdown
Owner

Currently the Save and Cancel buttons call close() on the composer window and then set a pointer to it as null.

If you instead use the window system to close the editor, by clicking X or by right-click and 'close' and so on, it will leave that pointer untouched. If you try to edit something later, it does not open a composer window because it thinks that there already is one.

With this change, closing the window either way will reset the pointer.

This was the problem causing issue Mudlet#3300.

@atari2600tim atari2600tim merged commit 0768756 into closeComposer Mar 5, 2020
@atari2600tim atari2600tim deleted the closeComposer-temp branch March 5, 2020 04:28
atari2600tim pushed a commit that referenced this pull request Mar 31, 2020
* Adds an option for variables to be included in searches, which is disabled by default now. This option is in the search menu on the left side of the search bar, positioned with the Case Sensitivity option.

* Revise: add "with-variables" icons & persistent storage of search options

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Update copyright stamp #1

* Update copyright date #2

* Trim tooltip to UX standard

Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: Vadim Peretokin <vperetokin@gmail.com>
atari2600tim pushed a commit that referenced this pull request Dec 15, 2024
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### 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 Mudlet#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](https://wiki.mudlet.org/w/Compiling_Mudlet#Checking_memory_leaks_.26_other_issues_.28sanitizers.29_3)
revealed that mpHost was being used after it was deleted:

```
=================================================================
==17843==ERROR: AddressSanitizer: heap-use-after-free on address 0x623000025e58 at pc 0x5555560abe75 bp 0x7fffffff7460 sp 0x7fffffff7450
READ of size 8 at 0x623000025e58 thread T0
    #0 0x5555560abe74 in QWeakPointer<QObject>::internalData() const /usr/include/x86_64-linux-gnu/qt6/QtCore/qsharedpointer_impl.h:711
    #1 0x5555562c15ad in QPointer<dlgIRC>::data() const /usr/include/x86_64-linux-gnu/qt6/QtCore/qpointer.h:77
    #2 0x5555562bd715 in QPointer<dlgIRC>::operator dlgIRC*() const /usr/include/x86_64-linux-gnu/qt6/QtCore/qpointer.h:85
    #3 0x555556296c13 in dlgIRC::~dlgIRC() /home/vadi/Programs/Mudlet/src/dlgIRC.cpp:109
    #4 0x555556296e1f in dlgIRC::~dlgIRC() /home/vadi/Programs/Mudlet/src/dlgIRC.cpp:112
    #5 0x7ffff6ba04a0 in QObject::event(QEvent*) (/lib/x86_64-linux-gnu/libQt6Core.so.6+0x1a04a0)
...
```
This helped pinpoint the cause of the crash.

---------

Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant