glib: prevent race condition when registering types

According to Bertrand, a NullReferenceException was happening
(although not reproducible 100% of the times) at a line of code
that could not possibly cause this type of exception, which
could maybe be the result of memory corruption caused by a race
condition when dealing with unmanaged structures.

By inserting this new lock we make sure that we don't register
the same type twice (or more times) in different threads at the
same time. By using the Locker<T> class we also prevent holding
a lock for *every type registered* instead of just for the
specific type being registered.