The old restore dialog only showed a simple list of snapshots
so it was hard to see what each entry contained before
restoring. It also had a bug where pressing Restore could
close the dialog but not restore anything, because the
pre-restore backup step treated no changes to save as a faliure.
This change adds a dedicated restore dialog that shows the
snapshot time, summary, hash, and changed files. It also
updates the restore code to load snapshot details for the
dialog and to continue with the restore when the backup
step finds no new changes.
The wxWebView child can be destroyed before the
WEBVIEW_PANEL when WebKit's GTK widget is torn down
asynchronously (e.g., WebKit process crash or init
failure). The retry timer keeps firing on the
still-alive panel but m_browser is now a dangling
pointer, causing SIGSEGV at the virtual dispatch in
AddScriptMessageHandler.
Bind wxEVT_DESTROY on the wxWebView to null out
m_browser and stop the timer when the browser is
destroyed. Add null guards in DoInitHandlers,
AddMessageHandler, and ClearMessageHandlers.
AddScriptMessageHandler internally calls RunScript, which
yields the event loop. When this fires from a timer during
a wxProgressDialog yield (e.g., schematic loading checkpoint),
the reentrant yield crashes WebKit's JSC in sanitizeStackForVM.
The existing guard only checked for non-main event loops but
missed the case where the main loop itself is yielding. Add
IsYielding() to both DoInitHandlers and AddMessageHandler guards
so the timer re-defers until the loop is idle.
Replace CallAfter with m_initRetryTimer.StartOnce(0)
which gives the same deferred execution but is
automatically cancelled by ~wxTimer when the panel
is destroyed.
Background async library loading workers hold raw LIBRARY_TABLE_ROW
pointers into the LIBRARY_TABLE::m_rows vector. When ProjectChanged()
calls LoadProjectTables(), it destroys the old LIBRARY_TABLE objects
via unique_ptr replacement.
The workers were not aborted until after the tables were destroyed,
creating a window where workers could access freed memory.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23480
* add VARIANT and VARIANT_DESC to the list of known vars in the drawing
sheet editor.
* cache variant and variant description in respective objects.
* expand the respective text variables when building the drawing sheet.
* keep the cached variant and its description up-to-date when selecting
a variant in the GUI.
* pass variant and its description to the plotters.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23430
The knockout algo was a post-processing step, but it
only knew about the poly representation, and not the
new line segment optimization. Since the post-process
step proved to be fragile, knockouts are now fetched
from a callback from EDA_SHAPE::UpdateHatching().
Savers now serialize to in-memory HISTORY_FILE_DATA on the UI thread,
then Prettify + file writes + git stage/diff/commit run on a background
thread via GetKiCadThreadPool(). An atomic skip-if-busy flag prevents
overlapping saves; WaitForPendingSave() ensures clean shutdown.
Extracted FormatBoardToFormatter and FormatSchematicToFormatter so
SaveToHistory can serialize without touching disk. PROJECT savers use
sourcePath for file-copy semantics since project files are small.
The FOOTPRINT_PREVIEW_PANEL may instantiate prior to any other checks,
we need to ensure that this widget is realized on Linux prior to getting
the OpenGL calls otherwise GTKGetDrawingWindow may return NULL
incorrectly
WebKit's AddScriptMessageHandler calls RunScript internally,
which yields the event loop via DoYieldFor. When this runs
inside a nested event loop (e.g., Update PCB from Schematic's
modal dialog), JSC crashes in sanitizeStackForVM.
The previous fix used CallAfter to defer handler registration,
but CallAfter events fire immediately in the modal dialog's
event loop, creating a tight busy-wait that freezes the UI.
Replace CallAfter re-deferral with a wxTimer that retries
every 200ms until the main event loop is active. Also guard
AddMessageHandler's late-registration path with the same
nested loop check so handlers added after init are safe too.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23423
AsyncLoad() previously submitted one thread pool task per
library, which could saturate all available cores during
startup. This starved the GUI and blocked other thread pool
work like DRC.
Restructure to use a work-stealing pattern where a limited
number of worker tasks each pull from a shared queue. The
worker count is capped at pool_size - 2 (minimum 1), leaving
threads free for the UI and other operations. Tasks are still
submitted at lowest priority so any higher-priority work
takes precedence in the queue.
During LoadExistingRules, each call to AppendNewRuleTreeItem
triggered SelectItem, which fired the selection-changed handler.
That handler created a full PANEL_DRC_RULE_EDITOR per rule,
compiling 14 regex patterns, instantiating Scintilla, running
layout, then immediately destroying it when the next rule was
appended. Also fix other potential slow downs
Parse variant data from Altium .PrjPcb project files and
apply it to both schematic symbols and board footprints
during import. Each ProjectVariant section is read as an
INI group, and per-component variation entries are mapped
to KiCad variant structures on the matching designators.
RFC 3986 requires percent-encoding individual UTF-8 bytes. The
previous implementation iterated wxUniChar code points, producing
incorrect output for non-ASCII characters (e.g. é became %E9 instead
of %C3%A9, and multi-byte characters like emoji produced invalid
percent-encoding with more than two hex digits).
The bitmap overlay panels never cleared their background before
drawing. With wxBG_STYLE_PAINT the system skips auto-erase, so
stale pixels from previous panels bled through on Windows during
scrolling and rule switching.
Switch OnPaint from wxPaintDC to wxAutoBufferedPaintDC and clear
the full client area before drawing the bitmap. Wrap the panel
swap in SetContentPanel with Freeze/Thaw to suppress intermediate
repaints between destroy and layout.
Widen overlay text fields on Windows by 15px via a new platform
constant DRC_RE_OVERLAY_WE to allow for Windows wxTextCtrl border
padding
Extract duplicated helpers from remote provider files into shared
utilities. Split sendRpcMessage into purpose-specific functions.
Implement standard nonce-based exchange for re-auth. Provide
additional models for more efficient model/symbol/fp/etc using
external URLs. This allows us to better handle connection errors,
retries and large data packets.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23381
The Move command grabbed footprints from the nearest grid point rather
than the footprint anchor. This was caused by the reference point being
grid-aligned at drag start (commit 89be3fd390), which was a workaround
for fractional-nanometer positioning errors with non-page display origin.
Fix the root cause instead: AlignGrid(VECTOR2I, VECTOR2D, VECTOR2D)
relied on implicit VECTOR2D->VECTOR2I truncation to pass grid parameters
to computeNearest. For grid sizes that aren't exact in IEEE 754 double
(e.g., 0.254mm = 10 mil becomes 253999.999... instead of 254000), the
truncation produces incorrect grid sizes. Use KiROUND for the conversion
so all grid operations produce exact grid multiples.
With AlignGrid returning correct positions, the move tool no longer needs
to grid-align its reference point. Restore the anchor-based grab and the
GetMoveWarpsCursor() preference that 89be3fd390 removed.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23308
Setting flyout groups (units, crosshair, line modes) now cycle to the
next option on single-click instead of requiring a long-press to open
the palette. Tool flyout groups (route track, tune, dimensions, origins)
continue to activate the displayed tool on click.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23349
There seem to be some cases where the AUI perspectives are getting saved
with false visibility. This means they aren't getting shown when
settings are restored. We don't support hiding toolbars, so just always
force them to be shown because otherwise there is no other way to get
them back.
This is a tricky function that really needs a test around it.
Also it has several assumptions and traps:
- It will not work if the zones have multiple polygons in the poly sets
- It will not work if any polygon has line chains in a different order
- It is quadratic in number of zones and the compare itself is
superlinear (Simplify is called, evilly in a const function, which is
quadratic) and in a cyclic comparison, sort, which is presumably nlog-n
ish.
However, at least for the quadratic nature, profiling shows this to be
absolutely insignificant even for the VCU118 board.
When clicking flyout buttons for non-tool groups (crosshair style,
units, line modes), advance to the next option in the group instead
of re-dispatching the already-active action. Tool-type flyout groups
retain existing behavior of selecting the displayed tool.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23349
The BOM revision in IPC-2581 export was hardcoded to "1.0"
instead of reflecting the actual design revision.
The project file stores two separate fields: bomRev for
explicit user overrides set in the PCBnew export dialog or
via --bom-rev on the CLI, and schRevision for the value
auto-propagated from eeschema.