GLib 2.68 is now more than 3 years old, so we can definitely start
using it without thinking too much.
This allows us to drop lots of compat code that we had around.
And like the previous commit tells us, it will also help us to have
more correct code around.
We had various cases in which we were using const pointers for
non constant data, and in fact we were allocating and free'ing
them.
So let's handle all these case properly, so that we won't have
newer GLib complaining at us!
In case of suspension we can't just cancel the operations but
also return when completed, and this may not happen immediately
if there are ongoing operations.
This is automagically handled by libfprint internals, but in order
to make it happen, we need to cancel the ongoing operations and then
mark it completed. libfprint will then wait for the task completion
before actually marking the device as suspended.
We need to ensure that we are not overwriting the instance transfer, so
that we can be sure that we are only doing one transfer at time.
Also we need to ensure that the ssm unsetting it, is the owner of it.
We need to ensure that we are not overwriting the instance SSM, so that
we can be sure that we are only doing one operation at time.
Also we need to ensure that the task unsetting it, is the owner of it.
On Chimera Linux, which uses FreeBSD's userland tools, the original call
fails with the following error:
mktemp: mkstemp failed on /tmp/libfprint-XXXXXX.hwdb: Invalid argument
Moving the X's to the end of the template passed to `mktemp` fixes the
error, and also works with GNU's `mktemp`.
We can just use a GTask to handle the detection while using the
finish function to process the results to the image, so that it
is more predictable when this happens and it does not depend on
a thread returning.
Also remove data duplication when possible, this class wasn't
fully safe anyway to be used concurrently, so there's no point
to copy data when not needed. Also added the hard constraint to
not proceed with minutiae detection if something else is already
doing this.
At the same time we can mark the task to finish early on
cancellation.