No, it cant be used directly in a class declaration like you're trying to do. The error is because g_autoptr uses gccs attribute cleanup which doesn't work properly with class member variables since it's made for automatic variables that go out of scope...
You should use unique_ptr with a custom deleter thing for class members instead it should get rid of the cleanup error