Here's a patch that fixes the bug. Actually 4 bugs: 1) the initial cause: was freeing items prematurely and trying to free already freed items 2) memory leak: was trying to free items from already deleted menu 3) memory leak: was trying to free menu from already deleted window 4) other: was trying to set cursor in window with no associated frame --- grischka