I belive this is a very complicated patch for a simple bug. The reason for sometimes showing wrong subtitles is that the langinfo dictionary in TeletextMagazine is not cleared at channel change.
It's not just the TeletextMagazine langinfo that should decide which subs to show, since several channels can share the same teletext stream. In those cases the teletext stream contains subtitling for several channels and the only way to select the correct one is to look at the info in the SI packets.
See the Subtitle descriptor info in document ETSI EN 300 468.
However, thanks for your message. That bug can be the cause of some subtitles not showing after changing channel. I'll look into it.
If langinfo is cleared at channel change langinfo will only contain the languages and pages sent in subtitle descriptor. Only pages in langinfo get a language (realLang) set when added to pageEntries in SubtitleSelector all other pages get a empty string language and consequently CheckForPreferedLanguage will return only pages available in the subtitle descriptor.
I have used a quick fix for this by declaring langinfo public and clearing it in OnSubtitleReset.
Sounds interesting, but if I remember correctly language info was only taken from the teletext stream and the service information packets were not used at all before this patch. If it can be resolved in an easier way, and especially not involving Mediaportal.xml - like my patch does, I'll be very happy