473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Segmentation fault in STL iterator

I have the following piece of code, but it causes a segmentation fault.
I appreciate if someone can tell me why it crashes in bdl.end():

Line 55 of RectUtils.cpp:

void buildContainerRegion(vector<Rect*>& bdl) {
// thjis is line 55:
do_buildContainerRegion rtnValue = for_each (bdl.begin(),
bdl.end(), do_buildContainerRegion());

}
#0 0x014153e4 in __normal_iterator (this=0x4, __i=@0x4) at
stl_iterator.h:603
#1 0x0144117a in std::vector<BlockData*, std::allocator<BlockData*>
::end (this=0x0) at stl_vector.h:352

#2 0x01447583 in buildContainerRegion (bdl=@0x0, r=@0xbff0e434) at
RectUtils.cpp:55

Thank you.

Feb 11 '06 #1
2 3497
Hi

si***************@gmail.com wrote:
I have the following piece of code, but it causes a segmentation fault. [...] #2 0x01447583 in buildContainerRegion (bdl=@0x0, r=@0xbff0e434) at
RectUtils.cpp:55


Uh oh... bdl=@0x0?

Feb 11 '06 #2
TB
si***************@gmail.com sade:
I have the following piece of code, but it causes a segmentation fault.
I appreciate if someone can tell me why it crashes in bdl.end():

Line 55 of RectUtils.cpp:

void buildContainerRegion(vector<Rect*>& bdl) {
// thjis is line 55:
do_buildContainerRegion rtnValue = for_each (bdl.begin(),
bdl.end(), do_buildContainerRegion());

}
#0 0x014153e4 in __normal_iterator (this=0x4, __i=@0x4) at
stl_iterator.h:603
#1 0x0144117a in std::vector<BlockData*, std::allocator<BlockData*>
::end (this=0x0) at stl_vector.h:352

#2 0x01447583 in buildContainerRegion (bdl=@0x0, r=@0xbff0e434) at
RectUtils.cpp:55


Do you see the null pointers?

--
TB @ SWEDEN
Feb 11 '06 #3

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

Similar topics

4
by: Joel | last post by:
I have this bug that quite puzzled me. Basically I am having a segmentation fault on deleting an object, which belongs to a class which is the result of multiple inheritance from two other classes....
4
by: deancoo | last post by:
Ok, I've got another one for ya. The code I've pasted below compiles fine but produces a seg fault. I've put a comment in where the seg fault gets tripped. Can someone please explain what I've...
8
by: cpptutor2000 | last post by:
I am using an STL list to store data packets in a network simulator. The data packets are really C structs, which have other C structs inside them. These structs contain unsigned char arrays of...
5
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I...
18
by: Digital Puer | last post by:
Hi, I'm coming over from Java to C++, so please bear with me. In C++, is there a way for me to use exceptions to catch segmentation faults (e.g. when I access a location off the end of an array)?...
27
by: Paminu | last post by:
I have a wierd problem. In my main function I print "test" as the first thing. But if I run the call to node_alloc AFTER the printf call I get a segmentation fault and test is not printed! ...
1
by: cesco | last post by:
Hi, I'm using the boost library program_options for parsing the command line given to my program as described in the class Parameter: // Main.cpp #include "Parameter.h" using namespace std;...
9
by: aamircheema | last post by:
Hi, I have written a program (my first big program in c++). When I run the program it gives segmentation fault but when i use a printf statement to debug the program, it runs normally. I am very...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
1
by: jwlkr | last post by:
Hi, I am trying to sort a vector of a user defined type: a class which represents points in cartesian coordinates. The vector of points needs to be sorted according to the value of the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.