When clear() function is called, currentIndexChanged(int index) function also will be called with index = -1. So if you uses index at some variables, it cause the memory faults. So you have to add the following code at the very first line.
if(index <0) return;
I hope this will be helpful.