The terminal strip window's tree dock connects to its project's
destroyed() signal with a lambda capturing `this`, but without `this`
as the connection's context, and never disconnects it. When the dock is
deleted before the project, closing the project runs the lambda on
freed memory.
The terminal strip window is a single instance, parented to the editor
window it was first opened from. With two editor windows:
1. open the terminal strip manager from window 1 (project A);
2. open it from window 2 (project B): the same window switches to B,
still a child of window 1;
3. close window 1: the terminal strip window and its dock are deleted,
the connection to B stays;
4. close window 2, or project B: heap-use-after-free in the lambda
(terminalstriptreedockwidget.cpp:66), reported by AddressSanitizer
3 times out of 3. Freed by ~TerminalStripEditorWindow from
~QETDiagramEditor.
Passing `this` as the context removes the connection with the dock, as
FreeTerminalEditor, FreeTerminalModel and TerminalStripEditor already
do for the same signal. With the fix: no error, 3 times out of 3.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
qAsConst was deprecated in Qt 6.6; std::as_const (C++17, already the
project standard) is the drop-in replacement. Clears 46 -Wdeprecated-
declarations warnings across 18 files. No behavioural change.
Before this this commit the terminal strip editor couldn't only work on
the first project opened into this editor, all other project opened
after couldn't be edited.
This is now past, terminal strip editor can now edit every project open
in QElectroTech.
Since this commit, the terminals can't be moved from the tree widget,
instead we need to use the "move in" widget to move one or several
selected terminals in the table view.
TerminalStripTreeDockWidget::on_m_tree_view_currentItemChanged
call setCurrentStrip only when current strip changed, and not every time
when user click in another item on the tree view.