eeschema crash when mirroring more than one item at a time (eemodern) (lp:#1829833)

[Original report](https://bugs.launchpad.net/bugs/1829833) created by **Dino Ghilardi (dino-ghilardi)**
```
Trying to mirror a polyline in eeschema crashes (SIGABRT).

To reproduce the bug:

-Create a new project/schematic
-Draw "connected graphic lines", two or more segments/lines.
-Select the lines with a block operation
-press Y or X or use pop-up menu "mirror around vertical/horizontal axis"

and eeschema crashes.

Trying to mirror a single segment does not crash but does not work also
(nothing happens).

Also crashes if in the selected block there are two segments and other
items.


gdb message:
--------------------
Thread 1 "kicad" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: File o directory non esistente.
(gdb)


-----------------------------------
backtrace:
(gdb) backtrace
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff34ca42a in __GI_abort () at abort.c:89
#2  0x00007ffff34c1e67 in __assert_fail_base (fmt=<optimized out>,
    assertion=assertion@entry=0x7fffda781d39 "this->is_initialized()",
    file=file@entry=0x7fffda781cf0
"/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp",
    line=line@entry=1206,
    function=function@entry=0x7fffda781d60 <boost::optional<VECTOR2<int>
>::get() const::__PRETTY_FUNCTION__>
"boost::optional<T>::reference_const_type boost::optional<T>::get() const
[with T = VECTOR2<int>; boost::optional<T>::reference_const_type = const
VECTOR2<int>&]") at assert.c:92
#3  0x00007ffff34c1f12 in __GI___assert_fail (assertion=0x7fffda781d39
"this->is_initialized()",
    file=0x7fffda781cf0
"/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp",
line=1206,
    function=0x7fffda781d60 <boost::optional<VECTOR2<int> >::get()
const::__PRETTY_FUNCTION__> "boost::optional<T>::reference_const_type
boost::optional<T>::get() const [with T = VECTOR2<int>;
boost::optional<T>::reference_const_type = const VECTOR2<int>&]")
    at assert.c:101
#4  0x00007fffda47ae27 in boost::optional<VECTOR2<int> >::get
(this=0x5555570e6878)
    at
/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp:1206
#5  0x00007fffda47aca6 in boost::optional<VECTOR2<int> >::operator*() const
& (this=0x5555570e6878)
    at
/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp:1223
#6  0x00007fffda47ac38 in SELECTION::GetReferencePoint
(this=0x5555570e6848)
    at /home/dinoghi/SANDBOXKICAD5/src/kicad/include/tool/selection.h:205
#7  0x00007fffda48ac5a in SCH_EDIT_TOOL::Mirror (this=0x55555756faa0,
aEvent=...)
    at
/home/dinoghi/SANDBOXKICAD5/src/kicad/eeschema/tools/sch_edit_tool.cpp:735
#8  0x00007fffda49495c in std::__invoke_impl<int, int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (__f=
   @ 0x55555919af10: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffda48a5cc <SCH_EDIT_TOOL::Mirror(TOOL_EVENT const&)>,
__t=@0x55555919af20: 0x55555756faa0, __args#0=...) at
/usr/include/c++/6/functional:227
#9  0x00007fffda4947ad in std::__invoke<int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (
    __fn=
   @ 0x55555919af10: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffda48a5cc <SCH_EDIT_TOOL::Mirror(TOOL_EVENT const&)>,
__args#0=@0x55555919af20: 0x55555756faa0, __args#1=...) at
/usr/include/c++/6/functional:251
#10 0x00007fffda4945d7 in std::_Mem_fn_base<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&), true>::operator()<SCH_EDIT_TOOL*&,
TOOL_EVENT const&> (this=0x55555919af10, __args#0=@0x55555919af20:
0x55555756faa0, __args#1=...) at /usr/include/c++/6/functional:604
#11 0x00007fffda494361 in std::_Bind<std::_Mem_fn<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&)> (SCH_EDIT_TOOL*,
std::_Placeholder<1>)>::__call<int, TOOL_EVENT const&, 0ul,
1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>)
(this=0x55555919af10,

---------------------------------------
kicad info:

Thread 1 "kicad" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: File o directory non esistente.
(gdb)
(gdb) backtrace
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff34ca42a in __GI_abort () at abort.c:89
#2  0x00007ffff34c1e67 in __assert_fail_base (fmt=<optimized out>,
    assertion=assertion@entry=0x7fffda781d39 "this->is_initialized()",
    file=file@entry=0x7fffda781cf0
"/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp",
    line=line@entry=1206,
    function=function@entry=0x7fffda781d60 <boost::optional<VECTOR2<int>
>::get() const::__PRETTY_FUNCTION__>
"boost::optional<T>::reference_const_type boost::optional<T>::get() const
[with T = VECTOR2<int>; boost::optional<T>::reference_const_type = const
VECTOR2<int>&]") at assert.c:92
#3  0x00007ffff34c1f12 in __GI___assert_fail (assertion=0x7fffda781d39
"this->is_initialized()",
    file=0x7fffda781cf0
"/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp",
line=1206,
    function=0x7fffda781d60 <boost::optional<VECTOR2<int> >::get()
const::__PRETTY_FUNCTION__> "boost::optional<T>::reference_const_type
boost::optional<T>::get() const [with T = VECTOR2<int>;
boost::optional<T>::reference_const_type = const VECTOR2<int>&]")
    at assert.c:101
#4  0x00007fffda47ae27 in boost::optional<VECTOR2<int> >::get
(this=0x5555570e6878)
    at
/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp:1206
#5  0x00007fffda47aca6 in boost::optional<VECTOR2<int> >::operator*() const
& (this=0x5555570e6878)
    at
/home/dinoghi/SANDBOXKICAD5/usr/boost_1_69_0/boost/optional/optional.hpp:1223
#6  0x00007fffda47ac38 in SELECTION::GetReferencePoint
(this=0x5555570e6848)
    at /home/dinoghi/SANDBOXKICAD5/src/kicad/include/tool/selection.h:205
#7  0x00007fffda48ac5a in SCH_EDIT_TOOL::Mirror (this=0x55555756faa0,
aEvent=...)
    at
/home/dinoghi/SANDBOXKICAD5/src/kicad/eeschema/tools/sch_edit_tool.cpp:735
#8  0x00007fffda49495c in std::__invoke_impl<int, int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (__f=
   @ 0x55555919af10: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffda48a5cc <SCH_EDIT_TOOL::Mirror(TOOL_EVENT const&)>,
__t=@0x55555919af20: 0x55555756faa0, __args#0=...) at
/usr/include/c++/6/functional:227
#9  0x00007fffda4947ad in std::__invoke<int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (
    __fn=
   @ 0x55555919af10: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffda48a5cc <SCH_EDIT_TOOL::Mirror(TOOL_EVENT const&)>,
__args#0=@0x55555919af20: 0x55555756faa0, __args#1=...) at
/usr/include/c++/6/functional:251
#10 0x00007fffda4945d7 in std::_Mem_fn_base<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&), true>::operator()<SCH_EDIT_TOOL*&,
TOOL_EVENT const&> (this=0x55555919af10, __args#0=@0x55555919af20:
0x55555756faa0, __args#1=...) at /usr/include/c++/6/functional:604
#11 0x00007fffda494361 in std::_Bind<std::_Mem_fn<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&)> (SCH_EDIT_TOOL*,
std::_Placeholder<1>)>::__call<int, TOOL_EVENT const&, 0ul,
1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>)
(this=0x55555919af10,
```
Original tags: eeschema

Story points: 14.0