[LyX/master] Add move constructor and move assignment operator for FileName class
Stephan Witt
st.witt at gmx.net
Thu Jan 14 21:15:27 UTC 2021
Am 14.01.2021 um 20:56 schrieb Yuriy Skalko <yuriy.skalko at gmail.com>:
>
>> I used the debugger to bring some light into it.
>
> Thanks Stephan. It crashes on the call to move(?) assignment operator, but it is still not clear looking on these sources. I haven't tried Valgrind yet.
To trigger the crash I picked the second file out of the five files in the lastfiles vector. (But this happens with the first and with the last entry the same way.)
This operation effectively should move the 2nd entry to the 1st position.
The implemented logic in LastFilesSection::add removes the 2nd entry because of the match and inserts this FileName instance at position 1.
IMO the assignee (the new 1st slot of the lastfiles vector) hasn’t allocated the memory for private member d when the assignment operator is called - instead it is zero filled at that point.
I’m not so familiar with C++ internals. Perhaps the constructor wasn’t called or a wrong one or the move assignment constructor should care for it. Perhaps it is the implementation of the vector?
Stephan
More information about the lyx-devel
mailing list