Crash when prepending QString to QList



  • Hello,

    whenever I try to run the following code, I get a crash:
    @
    void NBhistoryInterface::addHistoryItem(QString title, QString url)
    {
    qDebug() << "SLOT: NBhistoryInterface::addHistoryItem(QString title, QString url) STATUS: Called";
    qDebug() << "m_historyTitle.prepend() Called";
    m_historyTitle.prepend(title);
    qDebug() << "m_historyTitle.prepend() Completed";
    qDebug() << "SLOT: NBhistoryInterface::addHistoryItem(QString title, QString url) STATUS: Completed";
    }
    @
    The program launches, then crashes when it gets to the prepend() call. This is becoming a major problem and an obstacle towards moving forward with my project. Here is the crash report provided by OS X 10.9:

    @

    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010

    VM Regions Near 0x10:
    -->
    __TEXT 0000000100187000-00000001001b4000 [ 180K] r-x/rwx SM=COW /Users/USER/Desktop/*/NovaBrowser_v2.app/Contents/MacOS/NovaBrowser_v2

    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0 <BUNDLEIDENTIFIER> 0x000000010019eae4 QList<QString>::prepend(QString const&) + 20 (qlist.h:546)
    1 <BUNDLEIDENTIFIER> 0x000000010019dec5 NBhistoryInterface::addHistoryItem(QString, QString) + 277 (nbhistory.cpp:29)

    @

    Help would be appreciated greatly!



  • How is m_historyTitle declared?



  • Thats the first place m_historyTitle is declared in the .cpp file.



  • What is a type of m_historyTitle ?
    Are you sure that NBhistoryInterface object is allocated ?



  • ok here is m_historyTitle in the .h file:
    @
    QList<QString> m_historyTitle;
    @

    yes NBhistoryInterface is allocated



  • Does you app generate a core file ?
    Check /cores/ directory after app crash.
    The directory should contain core.PID files.
    Could you put here a backtrace.



  • where would i find the cores file?



  • Check /cores/ directory after app crash.
    The directory should contain core.PID files.



  • Nicky, try running it through the debugger and analyze the data at crash time.


Log in to reply
 

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