During the loading of the attached document (from bug #319048 ), DockerStylesComboModel::styleApplied is called with the default paragraph style as argument.
The function assumes that the source model can provide an index for the supplied style (see the calls to indexForCharacterStyle). But the source model explicitly avoids adding items for the default styles, so these calls will return an invalid index, which results in a -1 being added as a row to m_usedStyles. In the next call to styleApplied, this will result in an invalid internalId being used to try to get the corresponding style from the style manager. The invalid style pointer is then used, resulting in the crash described in the bug.
The attached patch turns DockerStylesComboModel::styleApplied into a no-op if the supplied style is either the default character style or the default paragraph styles, since there will never be any items for these in the source model.
I'm not sure this is the correct fix, so would be great if e.g. Pierre could have a look.
Tried to load the attached document before/after the fix. And the problem seems solved.
I'm not 100% sure but I think the test for the stylesType is not needed as a default style should ...
Since Camilla reminded me that the styles models et.c. are being reworked (e.g. by Thorsten/Pierre?), I shouldn't invest too much time into them. But I think at least this crash fix would be nice in the interim. Perhaps it would be better to check for an invalid index instead of default styles. Inform me how you want the fix. Either way is OK with me :) (since the entire code might change soon anyway).