Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:43:56+00:00 2026-05-28T06:43:56+00:00

I found information from this thread and am starting to wonder if the information

  • 0

I found information from this thread and am starting to wonder if the information provided there is relevant to the cause of the issue I’m facing.

The QMap takes the following template arguments:

QMap< QString, int >

My main issue is that I’m initializing a cube class, and within that class contains various calls which are supposed to do very specific things.

One in particular revolves around setting up the class’ QMap members.

Observe the following:

mGeometry = new Geometry;
mGeometry->Init();

mCamera = QVector3D( 10.0, 10.0, 10.0 );

mCubeage.insert( "cubes", 0 );

Debug Output from mCubeage.insert( "cubes", 0 );

// ASCII compatibility

1) (uh oh)

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

2)

template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey,
                                                                       const T &avalue)
{
    detach(); //the called function

    QMapData::Node *update[QMapData::LastLevel + 1];
    QMapData::Node *node = mutableFindNode(update, akey);
    if (node == e) {
        node = node_create(d, update, akey, avalue);
    } else {
        concrete(node)->value = avalue;
    }
    return iterator(node);
}

3)

bool operator==(const QMap<Key, T> &other) const;
    inline bool operator!=(const QMap<Key, T> &other) const { return !(*this == other); }

    inline int size() const { return d->size; }

    inline bool isEmpty() const { return d->size == 0; }

    inline void detach() { if (d->ref != 1) detach_helper(); } //the called function/if statement
    inline bool isDetached() const { return d->ref == 1; }
    inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
    inline bool isSharedWith(const QMap<Key, T> &other) const { return d == other.d; }
    inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; }

inline bool operator!=(int value) const
    {
        return _q_value != value;
    }

4)

inline bool operator!=(int value) const
    {
        return _q_value != value;
    }

And…that’s where it stops – BOOM, segmentation fault. According to some of the Qt forums out there – in the realm of Internet – it is unwise to declare pointers to QMaps, which I originally thought of doing mainly because of the fact that one possible reason for this happening could be due to the fact that the QMap may not have been initialized properly. Yet, the fact that it’s a class member which has a default constructor I believe contradicts this.

Question

According to the above, why is this happening? What can be done about it?

Thoughts

Before someone mentions the fact that I’m passing a const char* to a QString parameter, I should note that I have already tried declaring a QString and passing it that as an argument. I should also probably note that I’m running this from Ubuntu 11.10, in Qt Creator.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:43:57+00:00Added an answer on May 28, 2026 at 6:43 am

    What can be done about it?

    There is only one thing : run your program under valgrind, and fix all problems you find.

    Why is it happening?!? Who knows? You didn’t provide enough information. Maybe stack smash, maybe you overwrote passed the end of some arrays, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found some information about this on Scott Hanselmans Blog Does anybody exactly know
Friends, This Ask Tom thread which I found via another SO question, mentions Table
I'm running through this tutorial found here: http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_multiple_tables.htm which teaches how to pass a
been searching a lot information about IoC/DI development, but I haven't found much information
I've searched the iPhone documentation and on google but have not found any information
I have found a lot of information on using UIImagePickerController to let the user
Lots of information on NSDates about the place, but I haven't found a clear
On Dapper's documentation found here it states: Limitations and caveats Dapper caches information about
I haven't found much on thin packs, and the man pages' information is rather
I've scored the internet for sources and have found a lot of useful information,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.