I'm at a complete loss here...
I'm trying to convert a QImage to a QPixmap but my program keeps crashing with the following stack trace. What's weird is it works fine if the QRectF that I specify doesn't have an upper left point of (0, 0). I know QImage has a copy method as well, but that was also failing (with no useful stacktrace), so I figured I'd try to work with Pixmaps instead... Line's 4/5 of the stacktrace are mine, but I'm basically doing the following
QImage _drawing = QImage(1024, 1024);
// fill _drawing with some data
QRect i_work = QRect(1, 1, 10, 10);
QRect i_break = QRect(0, 0, 10, 10);
QPixmap foo = QPixmap::fromImage(_drawing);
// QPixmap good = foo.copy(i_work); // I work
QPixmap broken = foo.copy(i_break); // Segmentation fault...
StackTrace:
Program received signal SIGSEGV, Segmentation fault.
0x01f44024 in QBasicAtomicInt::ref (this=0xabababab)
at ../../include/QtCore/../../src/corelib/arch/qatomic_i386.h:120
120 ../../include/QtCore/../../src/corelib/arch/qatomic_i386.h: No such file
or directory.
in ../../include/QtCore/../../src/corelib/arch/qatomic_i386.h
(gdb) bt
#0 0x01f44024 in QBasicAtomicInt::ref (this=0xabababab)
at ../../include/QtCore/../../src/corelib/arch/qatomic_i386.h:120
#1 0x01964d3e in QImage::QImage (this=0x28cc70, image=...)
at image\qimage.cpp:1125
#2 0x01990682 in QRasterPixmapData::fromImage (this=0xc391a00,
sourceImage=..., flags=...) at image\qpixmap_raster.cpp:151
#3 0x019862ab in QPixmap::fromImage (image=..., flags=...)
at image\qpixmap.cpp:2031
#4 0x00423fdc in TxImage::getSelection (this=0xc3b6cb0, selection_area=...)
at TxImage.cpp:207
#5 0x004421e2 in RomView::mouseReleaseEvent (this=0xc397978, event=0x28d5fc)
at RomView.cpp:261
#6 0x019241a0 in QWidget::event (this=0xc397978, event=0x28d5fc)
at kernel\qwidget.cpp:8187
#7 0x01c9e6bc in QFrame::event (this=0xc397978, e=0x28d5fc)
at widgets\qframe.cpp:557
#8 0x01d2bf0f in QAbstractScrollArea::viewportEvent (this=0xc397978,
e=0x28d5fc) at widgets\qabstractscrollarea.cpp:1043
#9 0x01e9aae6 in QGraphicsView::viewportEvent (this=0xc397978,
event=0x28d5fc) at graphicsview\qgraphicsview.cpp:2862
#10 0x01f86a13 in QAbstractScrollAreaPrivate::viewportEvent (this=0xc3969f8,
event=0x28d5fc) at widgets//qabstractscrollarea_p.h:100
#11 0x01f8506c in QAbstractScrollAreaFilter::eventFilter (this=0xbfa7388, o=
0xbf43978, e=0x28d5fc) at widgets//qabstractscrollarea_p.h:116
#12 0x6a1ffc73 in QCoreApplicationPrivate::sendThroughObjectEventFilters (
this=0xa7a46d8, receiver=0xbf43978, event=0x28d5fc)
at kernel\qcoreapplication.cpp:847
#13 0x018d96e5 in QApplicationPrivate::notify_helper (this=0xa7a46d8,
receiver=0xbf43978, e=0x28d5fc) at kernel\qapplication.cpp:4392
#14 0x018d7909 in QApplication::notify (this=0x28fe34, receiver=0xbf43978,
e=0x28d5fc) at kernel\qapplication.cpp:3959
#15 0x6a1ff9dc in QCoreApplication::notifyInternal (this=0x28fe34,
receiver=0xbf43978, event=0x28d5fc) at kernel\qcoreapplication.cpp:732
#16 0x01f4d53e in QCoreApplication::sendSpontaneousEvent (receiver=0xbf43978,
event=0x28d5fc)
at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#17 0x018d6118 in QApplicationPrivate::sendMouseEvent (receiver=0xbf43978,
event=0x28d5fc, alienWidget=0xc3adb70, nativeWidget=0x28fd60,
buttonDown=0x237941c, lastMouseReceiver=..., spontaneous=true)
at kernel\qapplication.cpp:3056
#18 0x0193fc63 in QETWidget::translateMouseEvent (this=0x28fd60, msg=...)
at kernel\qapplication_win.cpp:3317
#19 0x0193aaa6 in QtWndProc (hwnd=0x130fb8, message=514, wParam=0,
lParam=5373956) at kernel\qapplication_win.cpp:1657
#20 0x762c62fa in USER32!OffsetRect () from C:\Windows\syswow64\user32.dll
#21 0x900010c2 in ?? ()
#22 0x90909090 in ?? ()
#23 0x00df7d80 in operator+ ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)
I assure you that qatomic_i386.h exists and looking at line 120...
112: inline bool QBasicAtomicInt::ref()
113: {
114: unsigned char ret;
115: asm volatile("lock\n"
116: "incl %0\n"
117: "setne %1"
118: : "=m" (_q_value), "=qm" (ret)
119: : "m" (_q_value)
120: : "memory");
121: return ret != 0;
122: }
It is very difficult to tell what is going on. However QT Doc for QImage constructor says that
Warning: This will create a QImage
with uninitialized data. Call fill()
to fill the image with an appropriate
pixel value before drawing onto it
with QPainter.
Ensure that your QImage is filled properly by calling fill () method. Maybe this is the cause of the problem.
I was successfully able to solve the problem, but I'm not sure of the underlying problem, as the workaround doesn't really make a whole lot of sense to me.
So I was rendering the QImage on a QGraphicsScene/QGraphicsView. I had my QImage at location (0,0) on the scene and another QGraphicsItem also at location (0,0). Removing the other QGraphicsItem from the scene before calling copy on the QImage seemed to fix the problem. I've no idea what's so special about the point (0,0). The only thing I can think of is that isNull on a QPoint(0,0) returns true.
Related
I'm working on a program that only needs to use SDL to get screen resolutions when needed. I'd like to start the SDL init, get what I need, then close it. But I'm having trouble because when I start the SDL is takes over the single interrupt handle, I can't even set it to SIG_IGN...
I have a main method that creates a QApplication and a mainWidget.
While running, a function in the mainWidget starts an SDL instance using the following code:
bool MainWidget::getSomeSdlInformation()
{
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
SDL_SetMainReady();
SDL_Init(0);
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
qDebug() << "SDL_Init failed: " << QString::fromUtf8(SDL_GetError());
SDL_Quit();
return false;
}
signal(SIGINT, SIG_DFL);
// Get the needed video information
// Quit SDL
SDL_Quit();
return true;
}
After I "Quit SDL" I'd like to return the csignal interrupt back to QT, such that when a user presses control-c the program closes gracefully.
I'm having some trouble figuring our how to return control of the handle back to QT.
Here is an a crash log from preforming the control-c operation on my existing implementation:
Program received signal SIGSEGV, Segmentation fault.
__GI___pthread_mutex_lock (mutex=0x7fffffffd2f0) at ../nptl/pthread_mutex_lock.c:66
66 ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb) bt
#0 __GI___pthread_mutex_lock (mutex=0x7fffffffd2f0) at ../nptl/pthread_mutex_lock.c:66
#1 0x00007ffff48070da in XrmQGetResource () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#2 0x00007ffff47e4a42 in XGetDefault () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#3 0x00007ffff43ab0d0 in _XcursorGetDisplayInfo () from /usr/lib/x86_64-linux-gnu/libXcursor.so.1
#4 0x00007ffff43ab1a9 in XcursorGetDefaultSize () from /usr/lib/x86_64-linux-gnu/libXcursor.so.1
#5 0x00007ffff43ad435 in XcursorLibraryLoadCursor () from /usr/lib/x86_64-linux-gnu/libXcursor.so.1
#6 0x00007ffff706ed5c in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#7 0x00007ffff706f485 in QCursor::handle() const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#8 0x00007ffff707b364 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#9 0x00007ffff7080398 in QWidgetPrivate::create_sys(unsigned long, bool, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007ffff703231d in QWidget::create(unsigned long, bool, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007ffff703a86a in QWidget::setVisible(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x0000000000421270 in show (this=0x7fffffffda60) at /usr/include/qt4/QtGui/qwidget.h:497
#13 main (argc=1, argv=) at /home/jeff/Dev/openmw/apps/launcher/main.cpp:55
I am doing pixel drawing onto a Gtk::DrawingArea. Sometimes an expose event occurs and I need to redraw everything. But drawing every pixel again is slow, so I'm trying to create a Sdk::Pixmap and draw to it, then draw it to the screen when needed.
I'm trying to create a Sdk::Pixmap and draw to it with draw_point(). Here is my code:
In the hpp:
Glib::RefPtr<Gdk::Pixmap>pixmap;
Glib::RefPtr<Gdk::GC>pixGC;
In the cpp:
Glib::RefPtr<Gdk::Drawable> d = Gdk::Drawable::create(); // this has a value of 1
pixmap = Gdk::Pixmap::create(d, width, height, 3); // this call is giving me a seg fault
pixGC = Gdk::GC::create();
And when drawing:
pixmap->draw_point(pixGC,x, y); // don't even know if this works yet because of the seg fault
What's wrong with my code? :(
Also, I haven't written the code to draw to the actual DrawingArea yet.
Edit: Ok I fixed the first seg fault with:
pixmap = Gdk::Pixmap::create(get_window(), width, height, 3);
pixGC = Gdk::GC::create(get_window());
Thanks to this link:
http://marc.info/?l=gtkmm&m=108547746915009
But now I get this:
The program 'programName' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
(Details: serial 69525 error_code 9 request_code 64 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Stack trace:
Breakpoint 3, 0x00007ffff72830e0 in _XError ()
from /usr/lib/x86_64-linux-gnu/libX11.so.6
(gdb) bt
#0 0x00007ffff72830e0 in _XError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#1 0x00007ffff72801d1 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#2 0x00007ffff7280215 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#3 0x00007ffff7281050 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#4 0x00007ffff727c99d in XSync () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#5 0x00007ffff727ca2b in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#6 0x00007ffff725f954 in XCreatePixmap ()
from /usr/lib/x86_64-linux-gnu/libX11.so.6
#7 0x00007ffff3e2f48d in ?? ()
from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#8 0x00007ffff6de048d in Gdk::Pixmap::Pixmap (this=0x7fffd4000930,
drawable=..., width=256, height=256, depth=3, __in_chrg=<optimized out>,
__vtt_parm=<optimized out>) at pixmap.cc:55
#9 0x00007ffff6de0d71 in Gdk::Pixmap::create (drawable=..., width=256,
height=256, depth=<optimized out>) at pixmap.cc:317
#10 0x00000000004408e1 in Viewer::start (this=0x7fffffffea00, width=256,
height=256) at viewer.cpp:23
#11 0x000000000042e380 in AppWindow::rayTraceDrawer (this=0x7fffffffe8e0)
at appwindow.cpp:25
#12 0x0000000000432cd8 in std::_Mem_fn<void (AppWindow::*)()>::operator() (
this=0x767b58, __object=0x7fffffffe8e0)
at /usr/include/c++/4.6/functional:551
#13 0x0000000000432b8b in std::_Bind_result<void, std::_Mem_fn<void (AppWindow::---Type <return> to continue, or q <return> to quit---
*)()> (AppWindow*)>::__call<void, , 0>(std::tuple<>&&, std::_Index_tuple<0>, std::_Bind_result<void, std::_Mem_fn<void (AppWindow::*)()> (AppWindow*)>::__enable_if_void<void>::type) (this=0x767b58, __args=...)
at /usr/include/c++/4.6/functional:1287
#14 0x0000000000432ae3 in std::_Bind_result<void, std::_Mem_fn<void (AppWindow::*)()> (AppWindow*)>::operator()<>() (this=0x767b58)
at /usr/include/c++/4.6/functional:1378
#15 0x0000000000432972 in std::thread::_Impl<std::_Bind_result<void, std::_Mem_fn<void (AppWindow::*)()> (AppWindow*)> >::_M_run() (this=0x767b40)
at /usr/include/c++/4.6/thread:117
#16 0x00007ffff6031c78 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#17 0x00007ffff589de9a in start_thread ()
from /lib/x86_64-linux-gnu/libpthread.so.0
#18 0x00007ffff55ca3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#19 0x0000000000000000 in ?? ()
Is this because I'm creating the pixmap on a background thread?
Edit 2:
Nope, moved to UI thread and still crashing...
Edit 3:
Looks like I may have fixed it. The problem was accessing get_window() too early. Moved code to on_realize and it stopped crashing. Not sure if pixmap is valid yet though...will post after I figure out how to draw from pixmap to drawingarea.
And the solution after so many hours is:
In on_realize of your DrawingArea:
pixmap = Gdk::Pixmap::create(get_window(), width, height, get_window()->get_depth());
pixGC = Gdk::GC::create(get_window());
Draw to pixmap:
pixGC->set_foreground(color);
pixmap->draw_point(pixGC,x,y);
Then to draw to DrawingArea:
get_window()->draw_drawable(get_style()->get_fg_gc(get_state()),
pixmap,
0,0,0,0);
Here is the backtrace of gdb,
Program terminated with signal 11, Segmentation fault.
#0 0xb7e78830 in Gtk::Widget::get_width () from /usr/lib/libgtkmm-2.4.so.1
(gdb) bt
#0 0xb7e78830 in Gtk::Widget::get_width () from /usr/lib/libgtkmm-2.4.so.1
#1 0x08221d5d in sigc::bound_mem_functor0<bool, videoScreen>::operator() (this=0xb1c04714)
at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1787`enter code here`
#2 0x08221d76 in sigc::adaptor_functor<sigc::bound_mem_functor0<bool, videoScreen> >::operator() (this=0xb1c04710)
at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251
#3 0x08221d96 in sigc::internal::slot_call0<sigc::bound_mem_functor0<bool, videoScreen>, bool>::call_it (rep=0xb1c046f8)
at /usr/include/sigc++-2.0/sigc++/functors/slot.h:103
#4 0xb7b1ed35 in ?? () from /usr/lib/libglibmm-2.4.so.1
#5 0xb73c6bb6 in ?? () from /usr/lib/libglib-2.0.so.0
#6 0xb28ff1f8 in ?? ()
#7 0xb647479c in __pthread_mutex_unlock_usercnt () from /lib/libpthread.so.0
#8 0xb73c6446 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#9 0xb73c97e2 in ?? () from /usr/lib/libglib-2.0.so.0
#10 0xb3d11af8 in ?? ()
#11 0x00000000 in ?? ()
I figured out the line of crash,here is the code around that line.
1:currPicLoaded = 1;
2:int status = -1;
3:zoomedPicWidth = drawVideo1->get_width();
I figured out that above line is 3 is the cause of crash, but this line execute 5 times before crash.So I do not know why it does crash at 6th time.
PS : Above line of code is with in a thread which run continuously.
Any help is more than welcome :)
how should I proceed
Your very first step should be to find out which instruction caused the SIGSEGV. Do this:
(gdb) x/i $pc
The most likely cause is that your drawVideo1 object is either dangling (has been deleted), or is corrupt in some other way.
Since you are apparently on Linux (you didn't say, but you should always say), the first tool to reach for for debugging "strange" problems like this is Valgrind.
I'm having trouble figuring out the problem with my code...I'm in the early stages of prototyping a game (my first serious project). It frequently, but not always, crashes with a segmentation fault. Here's the flow of the program...
title screen - press z to start new game
player and enemy on screen...enemy takes a life when collided with, there are 4 lives.
when character's life is 0, game goes back to title screen - press z to start new game
The last step is where the crash occurs...The crash only seems to happen after the player dies and is brought back to the title screen and the player presses z to start another game, but it doesn't always crash. Through gdb, I've determined that it happens when the deconstructor for Title is called...
Here's the debug info and relevant code...I'll provide any other code/info if requested.
*** glibc detected *** /home/rzrscm/code/demogamething/game: free(): invalid pointer: 0x080c6b98 ***
//memory map info omitted
0xb7c54537 in raise () from /lib/libc.so.6
(gdb) where
#0 0xb7c54537 in raise () from /lib/libc.so.6
#1 0xb7c57922 in abort () from /lib/libc.so.6
#2 0xb7c8afbd in ?? () from /lib/libc.so.6
#3 0xb7c950ca in ?? () from /lib/libc.so.6
#4 0xb7c96918 in ?? () from /lib/libc.so.6
#5 0xb7c99a5d in free () from /lib/libc.so.6
#6 0xb7f4e776 in SDL_FreeSurface () from /usr/lib/libSDL-1.2.so.0
#7 0x0804ac7f in ~Title (this=0x80b4250, __in_chrg=<value optimized out>) at title.cpp:13
#8 0x08049d3a in GameState::load (this=0x804e368, loadState=LEVEL) at gamestate.cpp:39
#9 0x08049c5c in GameState::change (this=0x804e368, changeTo=LEVEL) at gamestate.cpp:26
#10 0x08049753 in Player::handleEvent (this=0x804e300) at player.cpp:102
#11 0x080490c8 in main () at main.cpp:27
So, what I know is that the crash occurs when it's changing states from TITLE to LEVEL...Here's the class function that unloads and loads the states...currentState is a private vector in the GameState class...
std::vector<GameState *> currentState;
void GameState::load(STATE loadState) {
if(state == TITLE) {
while(!currentState.empty()) {
delete currentState.back();
currentState.pop_back();
}
currentState.push_back(new Title());
}
else if(state == LEVEL) {
while(!currentState.empty()) {
delete currentState.back();
currentState.pop_back();
}
currentState.push_back(new Level(currentLevel));
}
}
The crash happens when the deconstructor for the Title class is called...It happens whether it's freeing the music or the image...Whichever one is the first function is the one it crashes on.
Title::~Title() {
SDL_FreeSurface(background);
Mix_FreeMusic(music);
background = NULL;
music = NULL;
}
Here's the code for the image loading function...
SDL_Surface *loadImage(std::string imageFile) {
SDL_Surface *loadedImage;
SDL_Surface *newImage;
loadedImage = IMG_Load(imageFile.c_str());
newImage = SDL_DisplayFormatAlpha(loadedImage);
SDL_FreeSurface(loadedImage);
return newImage;
}
[edit] I ran it through the debugger a couple more times without making changes to the code since I still can't find what's wrong...And each time the crash occurred while trying to free the music...
0xb7c54537 in raise () from /lib/libc.so.6
(gdb) backtrace
#0 0xb7c54537 in raise () from /lib/libc.so.6
#1 0xb7c57922 in abort () from /lib/libc.so.6
#2 0xb7c8afbd in ?? () from /lib/libc.so.6
#3 0xb7c950ca in ?? () from /lib/libc.so.6
#4 0xb7c9633e in ?? () from /lib/libc.so.6
#5 0xb79974e2 in ?? () from /usr/lib/libmikmod.so.2
#6 0xb7997640 in Player_Free () from /usr/lib/libmikmod.so.2
#7 0xb7ebb6e3 in Mix_FreeMusic () from /usr/lib/libSDL_mixer-1.2.so.0
#8 0x0804ac8d in ~Title (this=0x80c6bc0, __in_chrg=<value optimized out>) at title.cpp:14
#9 0x08049d3a in GameState::load (this=0x804e368, loadState=LEVEL) at gamestate.cpp:39
#10 0x08049c5c in GameState::change (this=0x804e368, changeTo=LEVEL) at gamestate.cpp:26
#11 0x08049753 in Player::handleEvent (this=0x804e300) at player.cpp:102
#12 0x080490c8 in main () at main.cpp:27
#5 0xb7c99a5d in free () from /lib/libc.so.6
#6 0xb7f4e776 in SDL_FreeSurface () from /usr/lib/libSDL-1.2.so.
You are probably freeing a pointer which is invalid. Now I read
free(): invalid pointer: 0x080c6b98
You might be trying to free an object which was not allocated dynamically. How does background get his value?
I am having a weird error when calling the insert function on a vector of custom types (which are basically graph nodes). Following is the code that is generating the seg fault:
69 for (int i = 0; i < size; i++) {
70 PDTNode * node = arguments[i]->getNode();
71 //addChild(node);
72 children.insert(it, node); // children is vector <PDTNode*>
73 it++;
74 node->addParent(this);
75 }
I double check all inputs and everything is OK and is not NULL. Below is the gdb stack trace that I got for the seg fault:
#0 0x00007ffff4793202 in ?? () from /lib/libc.so.6
#1 0x00007ffff479163a in memmove () from /lib/libc.so.6
#2 0x00000000004289f1 in std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<PDTNode*> (__first=0x100bd60, __last=0x10053c8,
__result=0x1001840) at /usr/include/c++/4.4/bits/stl_algobase.h:378
#3 0x00000000004289ab in std::__copy_move_a<false, PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_algobase.h:397
#4 0x0000000000428973 in std::__copy_move_a2<false, PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_algobase.h:436
#5 0x000000000042891d in std::copy<PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_algobase.h:468
#6 0x00000000004288dc in std::__uninitialized_copy<true>::uninitialized_copy<PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_uninitialized.h:93
#7 0x0000000000428847 in std::uninitialized_copy<PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_uninitialized.h:117
#8 0x00000000004287b8 in std::__uninitialized_copy_a<PDTNode**, PDTNode**, PDTNode*> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_uninitialized.h:257
#9 0x0000000000428684 in std::__uninitialized_move_a<PDTNode**, PDTNode**, std::allocator<PDTNode*> > (__first=0x100bd60, __last=0x10053c8,
__result=0x1001840, __alloc=...) at /usr/include/c++/4.4/bits/stl_uninitialized.h:267
#10 0x000000000042812e in std::vector<PDTNode*, std::allocator<PDTNode*> >::_M_insert_aux (this=0x1002810, __position=..., __x=#0x7fffffffd538)
at /usr/include/c++/4.4/bits/vector.tcc:338
#11 0x000000000043c46d in std::vector<PDTNode*, std::allocator<PDTNode*> >::insert (this=0x1002810, __position=..., __x=#0x7fffffffd538)
at /usr/include/c++/4.4/bits/vector.tcc:126
#12 0x00000000004d3ea9 in PDTFunctionDec::setArguments (this=0x10027e0, arguments=...) at PDTFunction.cpp:72
Any help is highly appreciated.
Thank you
I guess it is an iterator, but by inserting an element you trigger a relocation of the elements in the container and therefore invalidate the iterator. That should be the cause of your segmentation fault.
Insertion into a vector can invalidate iterators:
children.insert(it, node); // this can invalidate `it', triggering a
// segfault during the next iteration