crash of program



  • I am creating a music player for Android I use the Taglib library to recover the tags of the music. The algorithm I use to sort the different sounds by alphabetic order works for a list of some sounds but when you deppase the bar of 80 it makes my program crash for a long time. If anyone has an optimal solution for me I'm up


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Without showing your code it's impossible to remotely guess what is happening to your application.

    You should also state which version of Qt you are using on which version of Android.



  • I am using version 4.4 of QT and the test is done on a 4.4 version of Android


  • Moderators

    @niloBoby You probably mean you're using QtCreator 4.4
    Qt 4.4 is very very old. Which Qt version did you install?
    Also, as @SGaist said with your problem description it is simply not possible to say what the problem is. How could anybody know what's the problem with this information?
    Can you please show the relevant code?



  • Here is the function that allows sorting by alphabetic order. I'll put a ListModel on it. As I said earlier this function is effective when only has some file but when there are several the program crashes for a long time before walking:

    function sortByName(l){
        var listTemp=l
        for(var i= 0 ; i< listTemp.count; i++){
            for(var j=i+1; j< listTemp.count; j++){
    
                if(String(listTemp.get(i).artist).toLowerCase() > String(listTemp.get(j).artist).toLowerCase()){
                var temp = listTemp.get(j);
                var min = Math.min(j, i);
                var max = Math.max(j, i);
                listTemp.move(min, max, 1);
                listTemp.move(max-1, min, 1);
                }
            }
        }
        return l ;
    }
    


  • Small correction. The function returns listTemp instead of the l



  • @niloBoby Hi, when you say

    program crashes for a long time before walking

    You mean, your UI freezes for a time and later resumes to work normaly again.

    That is normal, your sorting blocks the event loop, it simply takes to much time.

    That said, theres a reason why people are encouraged to do any kind of logic in cpp not in qml. Its simply not made for someting like this!! Especially the java part.

    move your functions to a cpp extension and see if that fixes the timing issue.



  • ok thank's . I'm trying now J.Hilk


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.