Skip to content

Enhance editing#3

Closed
vadi2 wants to merge 188 commits intoSlySven:developmentfrom
vadi2:Enhance_editing
Closed

Enhance editing#3
vadi2 wants to merge 188 commits intoSlySven:developmentfrom
vadi2:Enhance_editing

Conversation

@vadi2
Copy link
Copy Markdown

@vadi2 vadi2 commented Jul 20, 2017

No description provided.

vadi2 and others added 30 commits March 26, 2017 15:15
It is my understanding that urgent bug fixes for the Release 3.0.0 need to
be based on a version with the same version major.minor.patch "Sematic
Version" string but, until actually "released" will carry a "-dev" build
suffix. This commit will introduce the change so that the resultant point
in the repository becomes the start point for such fixes and other work.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
This is a false positive because lua_error doesn't return.
The writes in the if statement are dominated by the write two lines down.
* Start on coding guidelines

I figure it's best to have this inside contributing guidelines than on our wiki because it'll be closer to the source - when someone wants to contribute, they'll see the guidelines right here and then without having to go on the wiki.

Plus, this'll also enforce team agreement for new guidelines
* sound - bugfix and enhance

This moves sound from 4 static players into an unlimited QList,
fixing https://bugs.launchpad.net/mudlet/+bug/1645064

It also adds volume (0-100) to the LUA playSoundFile command, with 100
(maximum) substituted if not present for backwards compatability.
This was one item inspired by the work of the coder(s) who forked Mudlet to
something that could handle Utf-8 in some manner. It was something that
struck me as potentially useful (they used it) but their implementation
did not quite match up to how we structure things.  The original only
reported the installation or un-installation of a module or package in
Host::installPackage(...) or Host::uninstallPackage(...)  but as those
methods are used in a number of manners it was remiss, I think, not to
report the second argument to those methods which may have a bearing on the
significance of them being run.  Also the original appended the package
or module name onto the end of the fixed event name meaning a separate
event handler would have to be registered to capture the loading or
unloading of each different package/module name concerned.  I have revised
the code so that a uniform "sysInstallPackageEvent" and
"sysUninstallPackageEvent" is generated for all modules/packages that are
changed, with the following arguments:

* "sysInstallPackageEvent"
* (string) package/module name
* (number) nature of event:
  * 0 - package
  * 1 - module (via UI or normal profile loading)
  * 2 - module (via a "sync" event from another profile)
  * 3 - module (via a script)
* (string) file name of package, archive file name for module

* "sysUninstallPackageEvent"
* (string) package/module name
* (number) nature of event:
  * 0 - package
  * 1 - module (via UI)
  * 2 - module (via a "sync" event from another profile)
  * 3 - module (via a script)

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

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
These events were inspired by "Zoilder" in a Mudlet derivative in 2015
called MudletRL for the Spanish MUD whose website is at
www.reinosdeleyenda.es

For "sysInstallPackage" the original version appended the packageName and
"Event" to "sysInstallPackage", but I have revised it to pass the
packageName as a separate argument. Due to the range of circumstances in
which this method can be called I have also included:
* the invoking "module" argument in case it is necessary to differentiate
  the way in which the installPackage code is called - I think this could
  be a factor in some use cases that Zoilder would not have experienced in
  their usage.
* the original package or module archive filename

The originators comment was effectively (ES):
«Se ejecuta el evento que indica que se ha instalado el paquete. Así el
propio paquete puede auto-inicializarse sin tener que reabrir la sesión».
which I think translates to (EN):
"The event that indicates that the package is installed runs. Thus the
package itself can auto-initialize without having to reopen the session."

For "sysUninstallPackageEvent" things are largely the same except that
there is no file name argument in the TEvent
The original comment was effectively (ES):
«Se ejecuta el evento que indica que se va a desinstalar el paquete. Así el
propio paquete puede eliminar lo que necesite sin tener que reabrir la
sesión».
Which translates, I think, to (EN):
"The event that indicates that the package is to be uninstalled is run. So
the package itself can eliminate what you need without having to reopen the
session."

I have recently learned that it is preferable to use QLatin1String rather
than QStringLiteral for QStrings that are not to be subjected to the
translation process!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Also wrap fixed strings in TEvent instances in QLatin1String(...) wrappers
instead of prior QStringLiteral(...) as the former is more efficient for
strings that ARE ASCII in origin.

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

Following further discussions it was decided to avoid "sub-typing" the
install and uninstall events depending on the cause and instead provide
differently names ones to differentiate the initiation action. So we now
have, for installation:
* sysInstallPackageEvent -  ANY package relate install
* sysInstallModuleEvent - User interface or profile loaded module install
* sysSyncInstallModuleEvent - Module reloaded because it was already
  loaded but it had been edited and updated from a DIFFERENT active
  profile, either via the "reloadModule(...)" lua command or from the
  "Save Profile" button in the other profiles's Editor.
* sysLuaInstallModuleEvent - Module loaded via a Lua installModule(...)
  command in this profile.
Similarly for removal:
* sysUninstallPackageEvent - as above (includes during upgrading of a
  Server provided GUI)
* sysUninstallModuleEvent
* sysSyncUninstallModuleEvent - occurs before a corresponding install event
* sysLuaUninstallModuleEvent

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
This is for scripts that don't care about the granularity of events.
Also do some minor whitespace changes.
vadi2 and others added 23 commits July 2, 2017 06:01
It'll now return the original value passed - it's way better than returning the wrong value.
* Replaced statustips with tooltips in the mapper menu

* Removed statusbar
…udlet#1173)

I think that that absence of an initialisation value for the (bool)
mTemporary flag recent moved out of the Mudlet "items" derived classes and
down to the base class was causing these issues as "temporary" items are
not shown in the editor and not saved at the end of a session.  Technically
a value of not zero is a "true" value according to C coding standards but
C++ tends to use the specific integer values of 0 and 1 (not -1) for false
and true - I suspect there was some ambiguity when another value was being
seen when a derived item was instantiated without this boolean being set
to a definite value.

I have taken the liberty to also go through and mark the template file up
for `const`ness... and also put in C++14 `explicit` on the constructors
so that there is no automatic use of the one without the argument when a
"parent" argument is given and vice-versa.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
* Downgraded C++ required version back to C++11 temporarily

* Downgraded C++14 features to C++11
Following on from Mudlet#1096 I realised
that the search capability was still not case sensitive and given that Lua
is a case preserving language this struck me as a nuisance.  It is now
possible to configure this feature when searching with a button that
displays three line of letters "ABCD"/"AbCd"/"abcd" with all three lines
highlighted when searches are not case sensitive (i.e. a search for "A"
will also find "a") and only the middle line when the case does matter
(i.e. a search for "A" will not find the lower case one).

As we now have "boarder-outlines" around all the instances found in an
element in a lua script component, we ought to have a means to removed them
afterwards without having to click on another item and then return to the
current one being considered.  This commit also adds a clear button
to both clear the treeWidget_searchResults but also to remove those border
outlines.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Now clicking on a result in the search tree widget should put the focus
(and the cursor) on the first (or selected term depending on case) within
item.

Moved several methods in dlgTriggerEditor from being declared as SLOTs when
they are not so used:
* (void) recursiveSearchTriggers(TTrigger*, const QString&)
* (void) recursiveSearchAlias(TAlias*, const QString&)
* (void) recursiveSearchScripts(TScript*, const QString&)
* (void) recursiveSearchActions(TAction*, const QString&)
* (void) recursiveSearchTimers(TTimer*, const QString&)
* (void) recursiveSearchKeys(TKey*, const QString&)

In that class I also renamed:
* (void) recurseVariablesDown(TVar*, QList<TVar*>&, bool)
                   ==> recursiveSearchVariables(TVar*, QList<TVar*>&, bool)
because it had the same name as another function with a different signature
but it is used in the same manner as the previously mentioned no longer
SLOT methods.

Also renamed in the same class was:
* (void) slot_search_triggers(const QString)
                                 ==> slot_searchMudletItems(const QString&)
because it is now used to search all item types not just "Triggers" as it
may once have done!

I added a couple of enums to the same class, both for use with the search
functionality which this commit extends, the first is used to categorise
the data elements that are stored in the first item in each row of the
search results tree widget and the second (used as one type of the first)
to identify which part of a particular "item" the search result relates to
and thus how to process the stored data to goto the correct part of the
editor display when/if that result is selected by the user.

Elements were also renamed to try and be a bit more consistent across the
different Mudlet "item" types:

In "aliases" form/dialog:
* (QLineEdit *) pattern_textedit ==> lineEdit_alias_pattern
* (QComboBox *) comboBox ==> comboBox_alias_regex
* (QLineEdit *) substitution ==> lineEdit_alias_command

In "actions" (buttons/menus/toolbars) form/dialog:
* (QCheckBox *) checkBox_pushdownbutton
                                      ==> checkBox_action_button_isPushDown
* (QLineEdit *) lineEdit_command_down
                                    ==> lineEdit_action_button_command_down
* (QLineEdit *) lineEdit_command_up ==> lineEdit_action_button_command_up
* (QSpinBox *) buttonColumns ==> spinBox_action_bar_columns
* (QPlainTextEdit *) css ==> plainTextEdit_action_css
* (QComboBox *) comboBox_location ==> comboBox_action_bar_location
* (QComboBox *) comboBox_orientation ==> comboBox_action_bar_orientation
* (QComboBox *) buttonRotation ==> comboBox_action_button_rotation
* (QLabel *) label_command_down ==> label_action_button_command_down
* (QLabel *) label_command_up ==> label_action_button_command_up

In "keys" form/dialog:
* (QPushButton *) pushButton_grabKey ==> pushButton_key_grabKey
* (QLineEdit *) lineEdit_command ==> lineEdit_key_command
* (QLineEdit *) lineEdit_name ==> lineEdit_key_name
* (QLineEdit *) lineEdit_key ==> lineEdit_key_binding

In "scripts" form/dialog:
* (QLineEdit *) lineEdit ==> lineEdit_script_event_handler_entry
* (QListWidget *) listWidget_registered_event_handlers
                            ==> listWidget_script_registered_event_handlers
* (QToolButton *) toolButton_add ==> toolButton_script_add_event_handler
* (QToolButton *) toolButton_remove
                                  ==> toolButton_script_remove_even_handler

In "timer" form/dialog:
* (QLineEdit *) lineEdit_command ==> lineEdit_timer_command
* (QTimeEdit *) timeEdit_hours ==> timeEdit_timer_hours
* (QTimeEdit *) timeEdit_minutes ==> timeEdit_timer_minutes
* (QTimeEdit *) timeEdit_seconds ==> timeEdit_timer_seconds
* (QTimeEdit *) timeEdit_msecs ==> timeEdit_timer_msecs

In "trigger pattern" form/dialog:
* (QComboBox) patternType ==> comboBox_patternType
* (QPushButton) fgB ==> pushButton_fgColor
* (QPushButton) bgB ==> pushButton_bgColor
* (QLabel) number ==> label_patternNumber

In "variables" form/dialog:
* (QCheckBox *) hideVariable ==> checkBox_variable_hidden
* (QComboBox *) key_type ==> comboBox_variable_key_type
* (QComboBox *) var_type ==> comboBox_variable_value_type

Note that in the above SOME other elements that are not used in a
programmatic way (e.g. some label identifiers or layout or container
type widgets) have also been renamed in a similar way.

Also:
* The layout of the Timer editor has been "improved" and also now reports
the milli-seconds in "zzz" format rather than "z" so that it is more
obvious that the number is thousandths of a second and can range from "000"
to "999".
* The patterns in the trigger part of the editor are now numbered in a
more human-friendly 1 to 50 instead of the previous 0 to 49.
* When a different trigger is selected the pattern widget is scrolled so
that the highest used pattern number is in view.
* The search process now also searches: the "name" field for all items and
where relevant the "command" fields of "actions", "aliases", "keys",
"timers" and "triggers" {including the "command (up)}" for "buttons" and
the "Css"/"Stylesheet" field for "buttons"/"menus"/"buttons" and the
"Events handled" for "Scripts" and the "pattern" field for "aliases".
* Searching on fields that are multi-line (the Lua scripts for all but
"variables"; the "Css/Stylesheet" for "buttons"/"menus"/"buttons") or
multi-element ("trigger" patterns) indicate the line/column of the start
of the search term or pattern number respectively in the "What" column of
the search results.
* I have tweaked the tooltip for the case sensitive search a little to
better explain its two states - overall the icon is not the most perfect
for the role but I could not think of a better way to make it's image(s)
better match it's effects.

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

Uses a means documented in https://stackoverflow.com/a/21376774/4805858
to replace the "standard" data model for the QComboBox with one from the
QListWidget which allows individual items to be flagged as disabled - which
the standard QComboBox does not.

This is designed to, in conjunction with a refactoring of code in
dlgTriggerEditor::slot_var_selected(...) to prevent invalid choices to be
made by the user (so types that they cannot enter through the Editor widget
but which are included in the type QComboBox s for display purposes:
functions for both and tables for one are disabled).

I would like to hide the editor widget when functions and tables are
selected in the tree widget - but that has proven to mess up the spacing
and layout for the remaining visible widgets and will have to be left until
I can bring: PR 436 "(release 30)bug fix get splitter working properly on
editor right side" into a usable state:
Mudlet#436

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
* Some not-used (or rather rejected) icons

* A typo of toolButton_script_remove_even_handler
when it should have been toolButton_script_remove_event_handler

* reordered all QGridLayout constructs in the "touched" dialog/forms in
strict ascending column & row (columns first) order - as Qt Form designer
does not currently enforce this but it increases Git noise in them.

* edited tooltip for hidden variable to match new form of hidden variables
control.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@vadi2 vadi2 closed this Jul 20, 2017
@vadi2 vadi2 deleted the Enhance_editing branch July 20, 2017 16:19
SlySven pushed a commit that referenced this pull request Jun 22, 2020
revise: use new Host::writeProfileData(...) method
SlySven pushed a commit that referenced this pull request Mar 14, 2024
Improve: rename some members and methods
SlySven added 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>
SlySven pushed a commit that referenced this pull request Oct 18, 2025
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Fix

```
Direct leak of 4000 byte(s) in 50 object(s) allocated from:
    #0 0x7f21286b61e7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x5652d10ed62c in TriggerHighlighter::setTheme(QString const&) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x202562c)
    #2 0x5652d10ecba7 in TriggerHighlighter::TriggerHighlighter(QTextDocument*) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x2024ba7)
    #3 0x5652d0998ef2 in SingleLineTextEdit::SingleLineTextEdit(QWidget*) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x18d0ef2)
    #4 0x5652d05f581a in Ui_trigger_pattern_edit::setupUi(QWidget*) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x152d81a)
    #5 0x5652d05f2792 in dlgTriggerPatternEdit::dlgTriggerPatternEdit(QWidget*) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x152a792)
    #6 0x5652d044b2a2 in dlgTriggerEditor::dlgTriggerEditor(Host*) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x13832a2)
    #7 0x5652d08479a9 in mudlet::addConsoleForNewHost(Host*) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x177f9a9)
    #8 0x5652d086efcb in mudlet::slot_connectionDialogueFinished(QString const&, bool) (/home/runner/work/Mudlet/Mudlet/src/mudlet+0x17a6fcb)
```
#### Motivation for adding to Mudlet
Better app quality
#### Other info (issues closed, discussion etc)
Discovered when running Mudlet with cmake.
SlySven pushed a commit that referenced this pull request Dec 4, 2025
…rocessing (Mudlet#8571)

<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Fix: heap-use-after-free when cleanup runs during alias/trigger/key
processing
#### Motivation for adding to Mudlet
Fixes crash when running
Mudlet#8559 (comment)
benchmark on Linux.
#### Other info (issues closed, discussion etc)
==617553==ERROR: AddressSanitizer: heap-use-after-free on address
0x51200086e6d0 at pc 0x589b650367f6 bp 0x7ffc44dbc700 sp 0x7ffc44dbc6f8
READ of size 8 at 0x51200086e6d0 thread T0
#0 0x589b650367f5 in Tree<TAlias>::isActive() const
(/home/vadi/Programs/Mudlet/build/src/mudlet+0xe8a7f5) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#1 0x589b65d81408 in TAlias::match(QString const&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bd5408) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#2 0x589b6560c156 in AliasUnit::processDataStream(QString const&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1460156) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#3 0x589b65c872b4 in Host::send(QString, bool, bool)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1adb2b4) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#4 0x589b65d96517 in TCommandLine::enterCommand(QKeyEvent*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bea517) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#5 0x589b65d93095 in TCommandLine::event(QEvent*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1be7095) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#6 0x7ac668391c8a in QApplicationPrivate::notify_helper(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:3307:31
#7 0x7ac66839b2f0 in QApplication::notify(QObject*, QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:2725:39
#8 0x7ac668b83f7f in QCoreApplication::notifyInternal2(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1109:24
#9 0x7ac66840cc0b in QWidgetWindow::event(QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qwidgetwindow.cpp:285:23
#10 0x7ac668391c8a in QApplicationPrivate::notify_helper(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:3307:31
#11 0x7ac668b83f7f in QCoreApplication::notifyInternal2(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1109:24
#12 0x7ac6677ee8e2 in
QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*)
/home/qt/work/qt/qtbase/src/gui/kernel/qguiapplication.cpp:2609:46
#13 0x7ac655cf9a04 in
QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher*)
/home/qt/work/qt/qtbase/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp:523:57
#14 0x7ac668be8b74 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
/home/qt/work/qt/qtbase/src/corelib/kernel/qobjectdefs_impl.h:461:57
#15 0x7ac668be8b74 in void doActivate<false>(QObject*, int, void**)
/home/qt/work/qt/qtbase/src/corelib/kernel/qobject.cpp:4255:30
#16 0x7ac6671e5142 in void QMetaObject::activate<void,
QDBusPendingCallWatcher*>(QObject*, QMetaObject const*, int, void*,
QDBusPendingCallWatcher* const&)
/home/qt/work/qt/qtbase/src/corelib/kernel/qobjectdefs.h:319:17
#17 0x7ac6671e5142 in
QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*)
/home/qt/work/qt/qtbase_build/src/dbus/DBus_autogen/include/moc_qdbuspendingcall.cpp:137:32
#18 0x7ac668bdd56b in QObject::event(QEvent*)
/home/qt/work/qt/qtbase/src/corelib/kernel/qobject.cpp:1411:31
#19 0x7ac668391c8a in QApplicationPrivate::notify_helper(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:3307:31
#20 0x7ac668b83f7f in QCoreApplication::notifyInternal2(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1109:24
#21 0x7ac668b879e4 in
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
/home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1904:36
#22 0x7ac668e7d416 in postEventSourceDispatch
/home/qt/work/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:246:39
#23 0x7ac6667145c4 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5d5c4)
(BuildId: 1eb6131419edb83b2178b682829a6913cf682d75)
#24 0x7ac666773736 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xbc736)
(BuildId: 1eb6131419edb83b2178b682829a6913cf682d75)
#25 0x7ac666713a62 in g_main_context_iteration
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5ca62) (BuildId:
1eb6131419edb83b2178b682829a6913cf682d75)
#26 0x7ac668e7caad in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
/home/qt/work/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:399:43
#27 0x7ac668b9002a in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
/home/qt/work/qt/qtbase/src/corelib/kernel/qeventloop.cpp:186:22
#28 0x7ac668b8ba59 in QCoreApplication::exec()
/home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1452:36
#29 0x589b64ab0675 in main
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x904675) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#30 0x7ac66602a1c9 in __libc_start_call_main
csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#31 0x7ac66602a28a in __libc_start_main csu/../csu/libc-start.c:360:3
#32 0x589b649c1d04 in _start
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x815d04) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)

0x51200086e6d0 is located 16 bytes inside of 296-byte region
[0x51200086e6c0,0x51200086e7e8)
freed by thread T0 here:
#0 0x589b64a9b9f1 in operator delete(void*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x8ef9f1) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#1 0x589b65d80711 in TAlias::~TAlias()
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bd4711) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#2 0x589b6560eefc in AliasUnit::doCleanup()
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1462efc) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#3 0x589b65c8e88d in Host::incomingStreamProcessor(QString const&, int)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1ae288d) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#4 0x589b651b73b5 in TMainConsole::runTriggers(int)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x100b3b5) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#5 0x589b64e39c4b in TBuffer::commitLine(char, unsigned long&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0xc8dc4b) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#6 0x589b64e28d4e in
TBuffer::translateToPlainText(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char>>&, bool)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0xc7cd4e) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#7 0x589b651b638d in
TMainConsole::printOnDisplay(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char>>&, bool)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x100a38d) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#8 0x589b64f9ed5b in TLuaInterpreter::feedTriggers(lua_State*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0xdf2d5b) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#9 0x7ac66942ffa0 in luaD_precall
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:320:10
#10 0x7ac66943ad7a in luaV_execute
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/lvm.c:591:17
#11 0x7ac66942e96c in luaD_call
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:378:5
#12 0x7ac66942af70 in luaD_rawrunprotected
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:116:3
#13 0x7ac66942bb94 in luaD_pcall
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:464:12
#14 0x7ac66942bce0 in lua_pcall
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/lapi.c:821:12
#15 0x589b64fd65f1 in TLuaInterpreter::call(QString const&, QString
const&, bool) (/home/vadi/Programs/Mudlet/build/src/mudlet+0xe2a5f1)
(BuildId: c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#16 0x589b65d84d31 in TAlias::execute()
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bd8d31) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#17 0x589b65d84577 in TAlias::match(QString const&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bd8577) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#18 0x589b6560c156 in AliasUnit::processDataStream(QString const&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1460156) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#19 0x589b65c872b4 in Host::send(QString, bool, bool)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1adb2b4) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#20 0x589b65d96517 in TCommandLine::enterCommand(QKeyEvent*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bea517) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#21 0x589b65d93095 in TCommandLine::event(QEvent*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1be7095) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#22 0x7ac668391c8a in QApplicationPrivate::notify_helper(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:3307:31

previously allocated by thread T0 here:
#0 0x589b64a9b171 in operator new(unsigned long)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x8ef171) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#1 0x589b6500f595 in TLuaInterpreter::startTempAlias(QString const&,
QString const&) (/home/vadi/Programs/Mudlet/build/src/mudlet+0xe63595)
(BuildId: c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#2 0x589b6512c41d in TLuaInterpreter::tempAlias(lua_State*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0xf8041d) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#3 0x7ac66942ffa0 in luaD_precall
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:320:10
#4 0x7ac66943ad7a in luaV_execute
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/lvm.c:591:17
#5 0x7ac66942e96c in luaD_call
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:378:5
#6 0x7ac66942af70 in luaD_rawrunprotected
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:116:3
#7 0x7ac66942bb94 in luaD_pcall
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/ldo.c:464:12
#8 0x7ac66942bce0 in lua_pcall
/build/lua5.1-rMDsVj/lua5.1-5.1.5/src/lapi.c:821:12
#9 0x589b64fd65f1 in TLuaInterpreter::call(QString const&, QString
const&, bool) (/home/vadi/Programs/Mudlet/build/src/mudlet+0xe2a5f1)
(BuildId: c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#10 0x589b65d84d31 in TAlias::execute()
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bd8d31) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#11 0x589b65d84577 in TAlias::match(QString const&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bd8577) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#12 0x589b6560c156 in AliasUnit::processDataStream(QString const&)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1460156) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#13 0x589b65c872b4 in Host::send(QString, bool, bool)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1adb2b4) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#14 0x589b65d96517 in TCommandLine::enterCommand(QKeyEvent*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1bea517) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#15 0x589b65d93095 in TCommandLine::event(QEvent*)
(/home/vadi/Programs/Mudlet/build/src/mudlet+0x1be7095) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4)
#16 0x7ac668391c8a in QApplicationPrivate::notify_helper(QObject*,
QEvent*)
/home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:3307:31

SUMMARY: AddressSanitizer: heap-use-after-free
(/home/vadi/Programs/Mudlet/build/src/mudlet+0xe8a7f5) (BuildId:
c98a5e4208b6daa52aa1b083c4ee6c4ab4552cc4) in Tree<TAlias>::isActive()
const
Shadow bytes around the buggy address:
  0x51200086e400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x51200086e480: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
  0x51200086e500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x51200086e580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x51200086e600: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
=>0x51200086e680: fa fa fa fa fa fa fa fa fd fd[fd]fd fd fd fd fd
  0x51200086e700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x51200086e780: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
  0x51200086e800: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x51200086e880: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x51200086e900: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==617553==ABORTING

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.