Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved, Moved] More memory needed?
Forum Updated to NodeBB v4.3 + New Features

[Solved, Moved] More memory needed?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 3.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spode
    wrote on last edited by
    #1

    @

    musica2::musica2(QWidget *parent) :
    QWidget(parent)
    {
    listafilemusicali = this->searchMusics();
    view = new QDeclarativeView(this);
    view->rootContext()->setContextProperty("listaCanzoni", QVariant::fromValue(this->getSongTitle(listafilemusicali)));
    view->setSource(QUrl::fromLocalFile("qml/Werfer/FliegendeLieder/musica2.qml"));
    this->setAttribute(Qt::WA_LockLandscapeOrientation);

    QObject *b = view->rootObject();
    b->setProperty("lunghezza", QApplication::desktop()->geometry().width());
    b->setProperty("altezza", QApplication::desktop()->geometry().height());
    
    connect(b, SIGNAL(request_close()), this, SLOT(openPrima()));
    connect(b, SIGNAL(request_plauseOrPlay()), this, SLOT(pauseOrPlay_media()));
    connect(b, SIGNAL(request_changeMedia()), this, SLOT(changeMedia()));
    connect(b, SIGNAL(request_hide()), this, SLOT(openWerfer()));
    
    playlist = new QMediaPlaylist();
    playlist->setPlaybackMode(QMediaPlaylist::Random);
    for(int i = 0; i < listafilemusicali.length(); i++)
        playlist->addMedia(QUrl(listafilemusicali.at(i)));
    mediaplayer = new QMediaPlayer();
    mediaplayer->setPlaylist(playlist);
    mediaplayer->play();
    
    b->setProperty("titolo", mediaplayer->media().canonicalUrl().toString().section("/", -1).toLower().replace(".mp3", ""));
    
    view->show();
    this->showFullScreen();
    

    }

    QStringList musica2::searchMusics()
    {
    QStringList listaFileMusicali, listaFolders, listaGenerale;
    listaFolders << "E:/Attachments"; //"C:/Users/7-Spode/Music";
    register int j = 0;
    QDir dir(listaFolders.at(j));
    #ifdef Q_OS_SYMBIAN
    listaGenerale = dir.entryList();
    while (j < listaGenerale.length())
    {
    if(listaGenerale.at(j).contains(".mp3"))
    listaFileMusicali.append("E:/Attachments/" + listaGenerale.at(j));
    qDebug()<<listaFileMusicali.at(j);
    j++;
    }
    return listaFileMusicali;
    #endif
    }
    @

    and the problem is:
    @
    Executable file: 49780 2012-01-14T17:16:41 C:\QtSDK\Symbian\SDKs\Symbian1Qt473\epoc32\release\gcce\udeb\Werfer.exe
    Connecting to 'COM9'...
    Connected.
    Launching: Werfer.exe
    Launched.
    [Qt Message] "01 - An Deiner Seite (Radio Version) - Unheilig.mp3"
    [Qt Message] "012-peter_fox_-alles_neu-ministry.mp3"
    [Qt Message] "12-peter_fox
    -zucker(feat._vanessa_mason)-ysp.mp3"
    [Qt Message] "153 andrea bocheli & laura pausini - vivo por ella.mp3"
    [Qt Message] "21 guns.mp3"
    [Qt Message] "21st Century Breakdown.mp3"
    [Qt Message] ASSERT failure in QList<T>::at: "index out of range", file /QtSDK/Symbian/SDKs/Symbian1Qt473/include/QtCore/qlist.h, line 456
    Thread has crashed: Thread 0x201 has panicked. Category: ASSERT failure i; Reason: 0
    The device 'Nokia C5-03 USB Serial Port (COM9)' has been disconnected.
    @

    that is why i am thinking that my app needs more memory. is it right? how to fix it?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      No, it is probably just an off by one error in you accessing your QList.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        @
        while (j < listaGenerale.length())
        {
        if(listaGenerale.at(j).contains(".mp3"))
        listaFileMusicali.append("E:/Attachments/" + listaGenerale.at(j));
        qDebug()<<listaFileMusicali.at(j); // think about this line, especially when
        // listaGenerale.at(j).contains(".mp3") is false
        j++;
        }
        @

        What makes you think that "index out of range" does indicate a insufficient memory problem, and not an out of range index?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          spode
          wrote on last edited by
          #4

          nothing:
          @
          listaGenerale = dir.entryList();
          while (j < listaGenerale.length())
          {
          if(listaGenerale.at(j).contains(".mp3"))
          {
          listaFileMusicali.append(listaGenerale.at(j));
          qDebug()<<listaFileMusicali.at(j);
          }
          j++;
          }
          @

          @
          Launched.
          [Qt Message] "01 - An Deiner Seite (Radio Version) - Unheilig.mp3"
          [Qt Message] "012-peter_fox_-alles_neu-ministry.mp3"
          [Qt Message] "12-peter_fox
          -zucker(feat._vanessa_mason)-ysp.mp3"
          [Qt Message] "153 andrea bocheli & laura pausini - vivo por ella.mp3"
          [Qt Message] "21 guns.mp3"
          [Qt Message] "21st Century Breakdown.mp3"
          [Qt Message] ASSERT failure in QList<T>::at: "index out of range", file /QtSDK/Symbian/SDKs/Symbian1Qt473/include/QtCore/qlist.h, line 456
          Thread has crashed: Thread 0x20c has panicked. Category: ASSERT failure i; Reason: 0
          The device 'Nokia C5-03 USB Serial Port (COM9)' has been disconnected.
          @

          and in fact next file does not contain ".mp3"

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            By all means it is not a good idea to use the same index j for different things. And that is what you are doing. If you have a list with 10 elements and you copy five of them into another list, how many elements will have you in the list?

            This should work
            @
            listaGenerale = dir.entryList();
            while (j < listaGenerale.length())
            {
            if(listaGenerale.at(j).contains(".mp3"))
            {
            listaFileMusicali.append(listaGenerale.at(j));
            qDebug()<<listaGenerale.at(j);
            }
            j++;
            }
            @

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              spode
              wrote on last edited by
              #6

              that is perfect! =) but do you know, you copied my code? =P

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                Yes, I did copy your code from the post above my post. Hope it does not create a copyright issue :D

                However, you might want to have a close look for the important modification I did.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  spode
                  wrote on last edited by
                  #8

                  ahahah! =D

                  @

                  listaGenerale = dir.entryList();
                  while (j < listaGenerale.length())
                  {
                  if(listaGenerale.at(j).contains(".mp3"))
                  {
                  listaFileMusicali.append(listaGenerale.at(j));
                  qDebug()<<listaGenerale.at(j);
                  }
                  j++;
                  }
                  @
                  i hope it is right! ;)

                  EDIT: Damn, it is not right. it persists to throw the same error: [Qt Message] ASSERT failure in QList<T>::at: "index out of range", file /QtSDK/Symbian/SDKs/Symbian1Qt473/include/QtCore/qlist.h, line 456 (working on symbian)

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    koahnig
                    wrote on last edited by
                    #9

                    Hope you still have this statement as in your original post
                    @
                    register int j = 0;
                    @
                    respectively you might want to leave out the register statement and write
                    @
                    int j = 0;
                    @

                    Vote the answer(s) that helped you to solve your issue(s)

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      spode
                      wrote on last edited by
                      #10

                      all right now. the problem was the increase of a variable!

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        andre
                        wrote on last edited by
                        #11

                        Best way to solve these issues: make sure that you know the relevant values. Just step through the procedure with your debugger, and watch what happens. Or, perhaps just insert a bunch of qDebug() statements to print out the values of everything you touch in that piece of code. I think it would have been very easy to track this issue this way.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved