Handler of wxCustomDateTimePicker? Destructor of the wxCustomDateTimePicker control is called before the CloseDialog method.
I just set BP inside of CloseDialog, but I even didn't stop there. The assert dialog occurs earlier then this method is called. So the reason is somewhere else.
The problem occurs on wxCustomDateTimePickerPopup::~wxCustomDateTimePickerPopup()
If I call GetEventHandler from ~wxCustomDateTimePickerPopup() it returns wxComboPopupEventHandler. If I remove this event handler (by calling
Code: Select all
RemoveEventHandler(GetEventHandler())
), then the following event handler will be equal to this (I guess that this is wxPanel event handler from which wxCustomDateTimePickerPopup is inherited).
And the assert occurs inside of wxPanel (from which wxCustomDateTimePickerPopup is inherited) destructor. But I can't understand why
Another UPD:
I found that when I reproduce the case, destructor of the wxCustomDateTimePickerPopup object is called before the destructor of the wxCustomDateTimePicker object and I see the assert. According to the call stack from the first screenshot, destructor of the wxCustomDateTimePickerPopup is called from wxWindowBase::DestroyChildren. I guess that this function is called for wxCustomDateTimePicker object, due to wxCustomDateTimePickerPopup is a child of wxCustomDateTimePicker, Destroy() is called for the popup object firstly and then the destructor is called.
If I just close the dialog using 'X' button, then destructor of the wxCustomDateTimePicker object is called first and then destructor of the wxCustomDateTimePickerPopup object and everything is OK then.
So quest for now is to understand why.