mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-11 13:43:13 +02:00
6dd7c2d926
Fix a use-after-free crash (SIGSEGV in QRegion::begin, Qt5Gui+0x49af60) confirmed by analysis of 19 coredumps. The crash was triggered when the scene viewport clip region was freed during zoom/resize events while QPicture::play() replayed drawPolyline commands through the scene painter. Qt's raster engine then dereferenced a stale QRegionData pointer. Root cause: CrossRefItem used three nested QPicture objects (m_drawing, m_hdr_no_ctc, m_hdr_nc_ctc). The nested drawPicture() calls amplified the use-after-free risk on any repaint event. Fix: remove all QPicture from CrossRefItem entirely. - updateLabel() now uses a QImage-backed dummy painter to compute m_bounding_rect, m_shape_path and m_hovered_contacts_map geometry. A bool m_update_map flag prevents the map from being overwritten during paint(). - paint() calls drawAsCross()/drawAsContacts() directly on the scene painter — no QPicture::play() anywhere in the class. - buildHeaderContact() now draws NO/NC symbols directly onto the painter instead of recording them into QPicture members. Also fix mouseDoubleClickEvent: the element under the click is now found directly from m_hovered_contacts_map using the event position, rather than relying on m_hovered_contact which could be reset by hoverMoveEvent between the two clicks of a double-click. Also remove setBold(true) on terminal name labels: the Qt PDF/SVG/print engine rendered bold at 4pt as extremely thick glyphs, making exports unreadable. Normal weight at 4pt is correct and legible on all backends. Fixes: SIGSEGV in CrossRefItem::paint() on zoom/resize Fixes: double-click navigation unreliable on Xref contact symbols Fixes: terminal name labels unreadable in PDF/SVG/print export