On GTK, the selected item is checked for its parent when being
unselected. This breaks if the parent has been removed by the Sync()
call, so we need to ensure that the unselect all call happens prior
GTK tries to get the parent item of selected elements when unselecting.
If we don't freeze, we run the risk of crashing if a selected item is
removed before being unselected. This causes a wx warning but a) this
is suppressed in release and b) warning message is better than crash.
See next commit for fix to avoid common case of the error
(Copper shapes, on the other hand, can. Since we use
GetItemDescription() to report DRC errors and the like,
it's better to have it report the net even when it's
<no net>.)
- Add a test to be sure a SCHEMATIC exists before trying to use it
- Delete items in Repeat list and undo/redo list before deleting the schematic
- Delete also these items when loading a new schematic (the repeat list was
not cleaned previously)
Before these fixes I see a use after delete issue due to dangling pointers
stored in Repeat list.
Also changes the redraw behaviour to not try and redraw
only when things entered the view (this didn't work
because it may be the netname that's entering the view,
not the whole track). Instead we only process a finite
number of tracks on each idle event (in order to avoid
#12436).
Note that we don't need the timer at all anymore as the
netnames are in fixed locations on the track and never
make the track look like it's being dragged.
Also improves performance by avoiding sqrt.
Apparently GCC does not like competing definitions of the == operator.
The recent refactoring away of all LIB_ITEM objects created a conflict
with the SCH_ITEM == operator definition. This change required some
rather ugly comparison changes. There were no unit test failures but
that doesn't mean something didn't get broken.
The previous overflow handling code casted the int_min value into an
unsigned, meaning that the min value and max value were almost the same,
clamping the output to unreasonable values.
Updated code handles floating points first, then does integer casting
through int64_t