Finally tracked down the cause of the segfault.