Stack overflow when captions disabled with custom captions

Feb 3, 2012 at 10:35 AM

I've found (or rather a client found) a nasty bug in my players where disabling the closed captions (by clicking the CC button) causes a crash.

After investigating the issue, it's a stack overflow that occurs during measurements to fit text in panels, more precisely, it crashes in CaptionBlockRegion.WrapElement(...) called from CaptionBlockRegion.RenderElementRecurse(...).

My workaround is disabling text wrapping in all my custom subtitle plugins, but I feel there must be a bug somewhere in SMF.


For instance, in the RenderElementRecurse method, there's a test :

if (... && element.CurrentStyle.Display == System.Windows.Visibility.Visible)

That I feel at first glance that should be failing. I may be totally wrong for this property's meaning though.


It looks like the caption rendering isn't properly aware that it should try to render, and ends up in a bad state where the content hasn't got a proper size, thus exploding during the measure attempt.

Nov 19, 2012 at 4:37 PM

wrapping seems to work fine for me apart from a bug where it uses the whole video area for calculating the wrapping instead of the caption region max bounds as defined using Origin and Extend of captionregion. See notes at: