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. QtCreator QSimulate tutorial - Part 8

QtCreator QSimulate tutorial - Part 8

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k Views
  • 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.
  • L Offline
    L Offline
    lapin
    wrote on last edited by
    #1

    So, I got through Part 7 just fine, then added the recommended code, creating new header files and making enhancements to some of the .cpp files. When I run, I am seeing a seg fault as soon as i elft mouse button click in the simulator panel. So, I tried using the
    debugger and have traced it to the setText() call in commandstationadd.h (called from scene.cpp - m_undostack->push( new CommandStationAdd(this, x, y)); ).

    BTW, if I use the Part 7 implementation and call addItem() instead, there's no issue with the left mouse button click.

    I stepped into qchar.h in the QLatinChar struct, where char c is 32 ' ' as displayed in the Value column in the debugger. Stepping into the inline explicit for QLatin1Char leads to the #else clause which wants to return ushort(uchar(ch));.

    @inline QChar::QChar(QLatin1Char ch) : ucs(ch.unicode()) {}@

    @ inline char toLatin1() const { return ch; }
    inline ushort unicode() const { return ushort(uchar(ch)); }
    @

    Then off to qstring.h:

    @#ifndef QT_NO_CAST_FROM_ASCII
    inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) : d(fromAscii_helper(ch))
    {}@

    Then:

    @inline QString::~QString() { if (!d->ref.deref()) free(d); }@

    Then qatomic_i386.h

    @inline bool QBasicAtomicInt::deref()
    {
    unsigned char ret;
    asm volatile("lock\n"
    "decl %0\n"
    "setne %1"
    : "=m" (_q_value), "=qm" (ret)
    : "m" (_q_value)
    : "memory");
    return ret != 0;
    }@

    where ret is: 8, still single stepping, we're back there again and ret is now 1, the 0 which shows '\0', then back in again and ret is now 191 (in red, no less), the 0 '\0' again and we finally end up with the seg fault.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thedarkone
      wrote on last edited by
      #2

      What did you do?

      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