Use a strong reference instead of more manual reference counting

Replaces part of #1078. Instead of doing manual reference counting, we use a `StrongRefPtr` in this method.