I don't think the way the teacher dealt with the girl was wrong, i am the son of two professors and all my life they talk to me about what they deal in school, i can add that they are pretty good teachers that are loved by their students but there is always a smartass or problematic one that could throw the whole class dynamic on the bin and they always dealt with it with that way to not permit it.
In the end, a teacher needs to guarantee that their pupils learn and this doesn't mean to be always liked.