problem with synchronization query

Hi,

on latest drivers we have problem with query used for synchronization

... //rendering code

    extern CVar VRenderSync;
    if ( VRenderSync.GetInt() > 0 )
    {
        m_syncQueries[ m_currSyncQuery ]->Issue();
        m_currSyncQuery = ( m_currSyncQuery + 1 ) % max( VRenderSync.GetInt(), 2 );
        m_syncQueries[ m_currSyncQuery ]->Wait();
    }
    EndScene(); // d3d endscene and preset inside

wait implementation

void CQuery::Issue()
{
    if ( m_state == EQS_Ready )
    {
        if( SUCCEEDED( m_query->Issue( D3DISSUE_END ) ) )
	{
		m_state = EQS_Pending;
	}
	else
	{
		LOG_INFO( "Query Issue failed\n" );
	}
    }
}

void CQuery::Wait()
{
    if ( m_state == EQS_Pending )
    {
        while ( m_query->GetData( NULL, 0, D3DGETDATA_FLUSH ) == S_FALSE )
        {
	    SwitchToThread();
        }
        m_state = EQS_Ready;
    }
}

in some frames it happens that m_query->GetData( NULL, 0, D3DGETDATA_FLUSH ) always return S_FALSE, so there is infinite loop, VRenderSync is set to 2