Quote Originally Posted by jpn View Post
You cannot delete the signal sender in a slot because the control returns to the sender after connected slots have been processed. However, you can use QObject::deleteLater() instead.
I donot think it is the deleting of signal sender in a slot that caused the crash, since the dynamically created and deleted buttons are not connected to any signals or slots. However, call QObject::deleteLater()instead indeed solved my problem. I think i misunderstand the order of deleting widgets and resizeEvent and showEvent / paintEvent. call deleteLater is safe here, but i still want to know why the crash happened, why the process call the objects that should have been deleted?

Any way, thank jpn, your advice is really helpful.