diff --git a/space_view3d_screencast_keys.py b/space_view3d_screencast_keys.py
index 93fcf7997cbc853b650fe9df09630c41d74120b3..0acb675bc8a0782bc2b0d7af40e4883386666c51 100644
--- a/space_view3d_screencast_keys.py
+++ b/space_view3d_screencast_keys.py
@@ -337,6 +337,13 @@ class ScreencastKeysStatus(bpy.types.Operator):
 
         return {'PASS_THROUGH'}
 
+    def cancel(self, context):
+        if context.window_manager.display_keys:
+            context.region.callback_remove(self._handle)
+            context.window_manager.display_keys = False
+
+        return {'CANCELLED'}
+
     def invoke(self, context, event):
         if context.area.type == 'VIEW_3D':
             if context.window_manager.display_keys == False: