[Development] Qt bug (crash on drag-n-drop on QPlainTextEdit)

Thiago Macieira thiago.macieira at intel.com
Wed Apr 25 08:22:09 CEST 2018


On Tuesday, 24 April 2018 22:37:33 PDT Thiago Radicchi Roque wrote:
>   1.  Is this the right way to fix the problem?

From a quick look at the code, no. The construction is basically:

    QTextBlock block = control->document()->findBlock(position);
    if (!block.isValid())
        return;
[...]
    QTextLine line = block.layout()->lineForTextPosition(position - 
block.position());

lineForTextPosition() can only return invalid if the position passed is not in 
the block in question. But findBlock() returned this block for that position, 
so that position should be in this block.

That means the problem is elsewhere. There's something else at work here.

>   2.  Is it fixed in Qt5? I don’t think so, but I am not sure.

You have to test. The code above is pasted from Qt 5.11, but since the problem 
is unlikely to be in this piece of code, I can't tell from looking at the code 
if the problem is still there.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Development mailing list