macOS Sierra 10.12.2 exposes a bug in Scintilla where releasing a ScintillaView's marginView will cause a crash.
In troubleshooting the problem, I found that the methods setRulersVisible:NO and setVerticalRulerView:nil on the marginView's scrollView (which should be safe to do) would also cause a crash even on releases prior to macOS Sierra 10.12.2.
I tracked the problem down to the marginView's init method where it sets its clientView to its scrollView's documentView. The crash went away when I commented out the code and I didn't notice any change in behavior with it removed. I don't understand why it's necessary but I assumed it was and instead added [marginView setClientView:nil] to the ScintillaView's dealloc method which also fixed the crash.
Included is a patch to 3.7.1's ScintillaView.mm.
Committed as [8aeb43].
Related
Commit: [8aeb43]