This change corrects all places where dangling pointers were observed to
cause crashes when running `brave_unit_tests`. Most fixes are merely a
matter of changing the initialisation order of members, with others
requiring `raw_ptr` instances to be cleared out when appropriate.