Blocking Animator events from the scene graph thread to avoid running

into QCoreApplication assertions. This is a workaround only as starting
animators happens in QskInputPanel and shuld be avoided there.
This commit is contained in:
Uwe Rathmann 2017-07-24 07:43:59 +02:00
parent 1d27ce667f
commit 972e04fd52

View File

@ -9,11 +9,28 @@
#include "QskEvent.h"
#include <QObject>
#include <QThread>
#include <map>
#include <vector>
#include <algorithm>
static inline bool qskCheckReceiverThread( const QObject *receiver )
{
/*
QskInputPanelSkinlet changes the skin state, what leads to
sending events from the wrong thread. Until we have fixed it
let's block sending the event to avoid running into assertions
in QCoreApplication::sendEvent
*/
const QThread *thread = receiver->thread();
if ( thread == nullptr )
return true;
return ( thread == QThread::currentThread() );
}
static inline QVariant qskAdjustedValue(
QskAspect::Aspect aspect, const QVariant& value )
{
@ -168,8 +185,11 @@ void QskHintAnimatorTable::start( QskControl* control,
animator.start();
QskAnimatorEvent event( aspect, QskAnimatorEvent::Started );
QCoreApplication::sendEvent( control, &event );
if ( qskCheckReceiverThread( control ) )
{
QskAnimatorEvent event( aspect, QskAnimatorEvent::Started );
QCoreApplication::sendEvent( control, &event );
}
}
const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect::Aspect aspect ) const
@ -217,8 +237,11 @@ bool QskHintAnimatorTable::cleanup()
if ( control )
{
QskAnimatorEvent event( aspect, QskAnimatorEvent::Terminated );
QCoreApplication::sendEvent( control, &event );
if ( qskCheckReceiverThread( control ) )
{
QskAnimatorEvent event( aspect, QskAnimatorEvent::Terminated );
QCoreApplication::sendEvent( control, &event );
}
}
}
else