nibags added a comment.
I did debug with gdb and valgrind, but the information is not relevant, since Kate freezes and I have to kill the process (I think I used the term "crash" incorrectly :S). I have done some tests and the problem is in the use of `#pop!some_context` on the main context ("_profile"). For example, formerly, when doing `#pop!some_context` on the main context, "some_context" was stacked on top of the main context, it did not replace it. Now, in KF5.50.0, the main context is removed from de "stack" and replaced by "some_context". In the AppArmor XML file I use `#pop#pop!some_context` in general to finish a rule and, in some cases, `#pop!some_context` is done in the main context, which produces the error in large files, since it is not a behavior that I envisioned. I do not know if I'm explaining myself well, but with this diff I solve the problem. REPOSITORY R216 Syntax Highlighting REVISION DETAIL https://phabricator.kde.org/D15773 To: nibags, #framework_syntax_highlighting, dhaumann, cullmann Cc: kwrite-devel, kde-frameworks-devel, michaelh, kevinapavew, ngraham, bruns, demsking, cullmann, sars, dhaumann