It is technically unknown if Charming actually defeated. After Shrek escapes. charming stabs him, not realizing he missed and hit Shrek in the arm pit. When Charming realized that he missed, they fought and dragon used her tail to knock the tower over. by the angle the cameras were at, Charming might have just got trapped in the window that was on the tower. If he did, he would have been trapped, If the window missed, then the tower would have defeated him.