← Back to team overview

ubuntu-phone team mailing list archive

Re: split() method failure with Qt5.3

 

On Mon, May 26, 2014 at 7:08 PM, Zoltán Balogh
<zoltan.balogh@xxxxxxxxxxxxx>wrote:

>
> On 05/26/2014 10:24 AM, Albert Astals Cid wrote:
>
>> On Sunday 25 May 2014 13:36:56 Zoltán Balogh wrote:
>>
>>> Hi,
>>>
>>> During the Qt5.3 migration work we  realized that the split() methods
>>> terminates the process it is used in when the separator is a regular
>>> expression.
>>>
>> Hi, I just tried the attached main.qml in qmlscene and it's working fine
>> under
>> 5.3 beta2 ppa packages. Is that because i didn't understand the problem
>> or did
>> the issue get fixed meanwhile?
>>
>> Cheers,
>>    Albert
>>
> Sorry, I was a bit too brief. The issue is exclusive on armhf:
> https://bugreports.qt-project.org/browse/QTBUG-39255
>
> It only causes problem when you use the split with a regular expression.
> So 'what ever'.split(" ") will do the job but if you try to use
> split(/\s+/) then it dumps core. Additional fun, that it malfunctions only
> when the regexp matches.
>
> Odd problem. The lucky part is that it happens only with the split. So all
> other string methods are working well. So I simple suggest to use match()
> method or whatever what does the same job.
>

Not so fast… It seems a similar issue affects String.replace(re, …). See
for yourself with the following example:

  import QtQuick 2.0
  Item {
    Component.onCompleted: "bla".replace(/\w/g, function(a) { return
a.toUpperCase() })
  }

I’ll look into working around this issue tomorrow, but I think we should
also consider looking into Qt’s code ourselves and see if we can come up
with a patch, in case upstream is not responsive enough.

Cheers,

 Olivier

Follow ups

References