Replace gpointer by an object reference