Files
loongoffice/sd/qa/unit/tiledrendering/data/OnePDFObject.odg
Tomaž Vajngerl 8ca89dc44a fix reseting WeakReference when moving a ref to another ref.
In ViewIteratorImpl::Reverse we std::move a reference, to a local
variable, however the reference was not reset correctly, which
caused a crash.

The issue is that a mpWeakConnection in WeakReference always
needs to be non-null as shown in reset(reference_type* pReference)
method. In the move constructor of WeakReference, we just std::move
the reference like:

mpWeakConnection = std::move(rWeakRef.mpWeakConnection);

This means rWeakRef.mpWeakConnection will be reset to null, which
is not what is expected, so what is missing is to instantiate
rWeakRef.mpWeakConnection by calling reset(nullptr) or using the
added reset() method.

This also adds a test for LOKit PDF search as this is the case
where the crash has been reproduced. It happens because of a
call to:

... std::move(maPosition.mxObject);

in the method ViewIteratorImpl::Reverse()

Change-Id: I43692554ba4f6231d00091269b7c902ab5cbc11f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95995
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-10 15:58:16 +02:00

122 KiB