Do not emit changed signal if the value has not really changed

NULL case
This commit is contained in:
Alessandro Pasotti 2019-06-06 11:58:35 +02:00
parent e1de2e0c13
commit 8d41253f5d

View File

@ -62,7 +62,11 @@ void QgsDateTimeEdit::clear()
{
displayNull();
changed( QDateTime() );
// Check if it's really changed or crash, see GH #29937
if ( ! dateTime().isNull() )
{
changed( QDateTime() );
}
// emit signal of QDateTime::dateTimeChanged with an invalid date
// anyway, using parent's signal should be avoided
@ -252,6 +256,7 @@ void QgsDateTimeEdit::setDateTime( const QDateTime &dateTime )
{
clear();
}
// Check if it's really changed or crash, see GH #29937
else if ( dateTime != QgsDateTimeEdit::dateTime() )
{
QDateTimeEdit::setDateTime( dateTime );