473,545 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

map insert cause crash, please look

Hi,
I have a simple code like this,

int NodeRepo::store Node(MyString key, MyNode* node){
this->nodeMap.insert (make_pair(key, node));

return 0;
}
In class MyString, there is operator < defined.

But the problem crashes when it comes to this function on Windows. I
launtch the VC debugger, I can see that the 2 arguments of the function
are all right, I checked their values.

The crash comes from some code in STL, make_pair() does return some
value, and then it comes to this STL function,

template <class _Key, class _Value, class _KeyOfValue,
class _Compare, class _Alloc> pair< _Rb_tree_iterat or<_Value,
_Nonconst_trait s<_Value> >, bool>
_Rb_tree<_Key,_ Value,_KeyOfVal ue,_Compare,_Al loc> ::insert_unique (const
_Value& __v)
{
_Link_type __y = this->_M_header._M_d ata;
...
}

The crash is because this->_M_header is pointing to some garbage.

I am not sure what this means.

Could you give me some pointer?

Jun 5 '06 #1
1 3945
On Mon, 05 Jun 2006 15:44:52 -0700, linq936 wrote:
Hi,
I have a simple code like this,

int NodeRepo::store Node(MyString key, MyNode* node){
this->nodeMap.insert (make_pair(key, node));

return 0;
}
In class MyString, there is operator < defined.

But the problem crashes when it comes to this function on Windows. I
launtch the VC debugger, I can see that the 2 arguments of the function
are all right, I checked their values.

The crash comes from some code in STL, make_pair() does return some
value, and then it comes to this STL function,

template <class _Key, class _Value, class _KeyOfValue,
class _Compare, class _Alloc> pair< _Rb_tree_iterat or<_Value,
_Nonconst_trait s<_Value> >, bool>
_Rb_tree<_Key,_ Value,_KeyOfVal ue,_Compare,_Al loc> ::insert_unique (const
_Value& __v)
{
_Link_type __y = this->_M_header._M_d ata; ...
}

The crash is because this->_M_header is pointing to some garbage.

I am not sure what this means.

Could you give me some pointer?


It means that you've FUBARed your map. Possibly because your operator<
doesn't define a strict weak ordering. Possibly because you've done
something else wrong in your program that has put your map into an
unstable state, and it's only manifesting here. We can't really tell
without more code. You need to create a minimal, compilable example that
shows the problem.. and show that to us.
Jun 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1619
by: jinhy82 | last post by:
Hi! I am currently creating a Registration form which contained: UserID Password, FirstName and LastName. These details would be inserted into Ms Access when I click submi button. But I encounter with the problem to insert 'Password'. It work fine if I did not insert 'Password' but if I did, it will shows that have "syntax error: INSERT...
5
1354
by: Mahmoud Al-Qudsi | last post by:
I have an application that builds and runs just fine on my PC. It's pure C#, no P/Invoke, no Win requirements or anything. I built the app, stuck the dependcies in the same DIR, and copied it to another PC. When I run it, it AVs right away, without any details or dialogs. The event viewer is of no help. How can I pin down the source of...
6
5555
by: nmehring | last post by:
I have an MFC app with 2000 users. I have one user that experiences a crash in our software anywhere from 1 to 5 times a week when opening a particular module. No other users have reported this particular crash so I don't think anyone else is experiencing it but I know other users are doing exactly what she is doing because it is our most...
11
3012
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7 and IE8. There is no issue when the controls are allowed to complete loading. Can you please tell me the best practice that handles this? ...
0
7459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7411
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5965
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1871
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.