Jeff Patterson
edf483d88f
Delete a terminal's conductors from a snapshot of its conductor list
...
Terminal::~Terminal() called qDeleteAll(m_conductors_list) on the live
member. Each Conductor destructor calls removeConductor() on both of its
terminals, and that removes the conductor from the same list qDeleteAll
is iterating. Mutating a QList while iterating it is undefined
behaviour; with two or more conductors on one terminal (terminal strips,
bridged terminals) it can skip a delete or delete one conductor twice,
which leaves another conductor's terminal1/terminal2 pointing at freed
memory.
The pattern dates from a00404bc9 (2021), which replaced a foreach loop
(iterating an implicit copy) with a direct qDeleteAll. It went unnoticed
until the deterministic sort keys added to Diagram::toXml() in #844
started reading pos() on both terminals of every conductor on every
save, including the periodic backup, which turned the stale pointer into
an EXC_BAD_ACCESS in QGraphicsItem::pos() while deleting an element.
Copy the list first and delete from the copy, restoring the pre-2021
behaviour. An isolated regression test (a hub terminal with 2 to 8
conductors, under AddressSanitizer) did not trigger the failure with the
old code, so none is included; the crash analysis and that attempt are
recorded in jp2images/qelectrotech-source-mirror#1 .
2026-09-16 04:27:27 -05:00
..
2026-09-13 09:56:25 +12:00
2026-09-16 13:09:48 +12:00
2026-09-15 17:07:15 +12:00
2026-01-16 15:24:35 +01:00
2026-01-26 18:47:43 +01:00
2026-09-16 18:51:34 +12:00
2026-08-27 07:27:25 +02:00
2026-09-12 11:41:36 +02:00
2026-08-17 10:25:44 +02:00
2026-08-06 23:05:05 +12:00
2026-07-11 21:47:04 +02:00
2026-08-22 13:34:29 +02:00
2026-07-31 09:52:32 +12:00
2026-09-11 20:11:19 +03:00
2026-08-11 11:48:58 +12:00
2025-05-22 21:33:32 +02:00
2026-09-16 04:27:27 -05:00
2026-01-16 15:24:35 +01:00
2026-09-07 10:44:30 +02:00
2026-01-16 15:24:35 +01:00
2026-08-22 13:34:29 +02:00
2026-08-10 21:19:56 +12:00
2026-01-16 15:24:35 +01:00
2026-08-17 16:46:49 +02:00
2026-08-23 18:25:23 +02:00
2026-09-16 18:51:34 +12:00
2026-09-05 15:48:28 +02:00
2026-08-13 15:45:15 +02:00
2026-01-16 15:24:35 +01:00
2026-08-09 09:11:40 +02:00
2026-08-09 09:11:40 +02:00
2026-09-13 02:00:50 +12:00
2026-09-11 20:12:09 +03:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-07-30 18:32:54 +12:00
2026-08-13 08:50:24 +08:00
2026-09-11 20:12:09 +03:00
2026-09-10 22:44:27 +02:00
2026-08-03 13:19:51 +12:00
2026-01-16 15:24:35 +01:00
2026-09-12 23:06:15 +12:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-08-13 15:45:15 +02:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-08-08 00:32:31 +02:00
2026-01-16 15:24:35 +01:00
2026-09-09 11:45:36 +12:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-09-15 22:09:10 +00:00
2026-09-15 22:09:10 +00:00
2026-09-13 12:58:43 +02:00
2026-08-22 11:25:47 +02:00
2026-07-14 19:27:16 +02:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-09-07 20:54:18 +12:00
2026-09-16 15:40:41 +12:00
2026-09-15 11:32:42 +12:00
2026-09-07 10:44:30 +02:00
2026-09-07 10:44:30 +02:00
2026-08-08 21:53:20 +12:00
2026-04-26 10:48:47 +02:00
2026-07-14 19:27:16 +02:00
2026-01-16 15:24:35 +01:00
2026-08-08 00:32:31 +02:00
2026-01-16 15:24:35 +01:00
2026-07-14 19:27:17 +02:00
2026-01-16 15:24:35 +01:00
2026-08-09 09:11:40 +02:00
2026-01-16 15:24:35 +01:00
2026-08-09 11:51:23 +02:00
2026-05-13 19:42:11 +02:00
2026-08-21 14:03:02 +02:00
2026-08-04 16:36:23 +12:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-09-07 10:44:30 +02:00
2026-01-16 15:24:35 +01:00
2026-08-08 08:09:45 +02:00
2026-08-06 21:37:40 +02:00
2026-08-09 19:25:56 +02:00
2026-08-06 21:37:40 +02:00
2026-09-03 15:05:22 +02:00
2026-04-19 10:44:52 +02:00
2026-09-16 15:40:41 +12:00
2026-09-16 15:40:41 +12:00
2026-09-11 16:28:11 +02:00
2026-06-20 22:31:06 +12:00
2026-09-11 07:10:15 +12:00
2026-08-11 11:33:28 +12:00
2026-01-16 15:24:35 +01:00
2026-08-24 18:24:30 +02:00
2026-08-14 08:58:36 +02:00
2026-08-28 19:55:29 +02:00
2026-08-12 12:29:56 +02:00
2026-09-14 14:55:17 +12:00
2026-01-16 15:24:35 +01:00
2026-09-14 22:14:36 +12:00
2026-09-11 16:28:11 +02:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-09-15 10:20:28 +02:00
2026-09-11 20:12:09 +03:00
2026-09-07 10:44:30 +02:00
2026-09-07 10:44:30 +02:00
2026-09-16 18:51:34 +12:00
2026-09-16 18:51:34 +12:00
2026-09-15 15:51:24 +12:00
2026-09-15 13:44:59 +12:00
2026-08-05 05:26:57 +12:00
2026-08-05 05:26:57 +12:00
2026-09-15 23:34:24 +00:00
2026-09-15 23:34:24 +00:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-08-16 07:16:33 +02:00
2026-01-16 15:24:35 +01:00
2026-09-12 23:27:46 +12:00
2026-07-17 10:25:49 +02:00
2026-08-08 00:32:31 +02:00
2026-01-16 15:24:35 +01:00
2026-07-17 21:01:26 +02:00
2026-07-17 21:01:26 +02:00
2026-08-09 01:34:22 +02:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-07-17 10:29:13 +02:00
2026-07-17 10:29:13 +02:00
2026-08-12 12:29:56 +02:00
2026-08-01 01:35:51 +12:00
2020-09-07 22:03:40 +02:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-01-16 15:24:35 +01:00
2026-09-12 14:50:22 +02:00
2026-08-08 12:31:45 +02:00
2020-09-07 22:03:40 +02:00
2026-01-16 15:24:35 +01:00
2026-06-11 12:39:43 +12:00
2026-06-11 12:39:43 +12:00