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:
parent
1d27ce667f
commit
972e04fd52
@ -9,11 +9,28 @@
|
|||||||
#include "QskEvent.h"
|
#include "QskEvent.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#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(
|
static inline QVariant qskAdjustedValue(
|
||||||
QskAspect::Aspect aspect, const QVariant& value )
|
QskAspect::Aspect aspect, const QVariant& value )
|
||||||
{
|
{
|
||||||
@ -168,8 +185,11 @@ void QskHintAnimatorTable::start( QskControl* control,
|
|||||||
|
|
||||||
animator.start();
|
animator.start();
|
||||||
|
|
||||||
|
if ( qskCheckReceiverThread( control ) )
|
||||||
|
{
|
||||||
QskAnimatorEvent event( aspect, QskAnimatorEvent::Started );
|
QskAnimatorEvent event( aspect, QskAnimatorEvent::Started );
|
||||||
QCoreApplication::sendEvent( control, &event );
|
QCoreApplication::sendEvent( control, &event );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect::Aspect aspect ) const
|
const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect::Aspect aspect ) const
|
||||||
@ -216,11 +236,14 @@ bool QskHintAnimatorTable::cleanup()
|
|||||||
it = m_data->map.erase( it );
|
it = m_data->map.erase( it );
|
||||||
|
|
||||||
if ( control )
|
if ( control )
|
||||||
|
{
|
||||||
|
if ( qskCheckReceiverThread( control ) )
|
||||||
{
|
{
|
||||||
QskAnimatorEvent event( aspect, QskAnimatorEvent::Terminated );
|
QskAnimatorEvent event( aspect, QskAnimatorEvent::Terminated );
|
||||||
QCoreApplication::sendEvent( control, &event );
|
QCoreApplication::sendEvent( control, &event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++it;
|
++it;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user