Android: Thread fix/optimization

Do the cheap test before sending an expensive query that might
use a mutex.

Task-number: QTBUG-41369
Change-Id: I78f03c84e5bbf0492f1b7ea18d1baa752a1beff2
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
bb10
Paul Olav Tvete 2014-09-22 14:22:53 +02:00
parent 7755b4af41
commit c712ec4543
1 changed files with 3 additions and 3 deletions

View File

@ -642,13 +642,13 @@ jboolean QAndroidInputContext::deleteSurroundingText(jint leftLength, jint right
// Android docs say the cursor must not move
jboolean QAndroidInputContext::finishComposingText()
{
if (m_composingText.isEmpty())
return JNI_TRUE; // not composing
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe();
if (query.isNull())
return JNI_FALSE;
if (m_composingText.isEmpty())
return JNI_TRUE; // not composing
const int blockPos = getBlockPosition(query);
const int localCursorPos = m_composingCursor - blockPos;