V
Vinu
Hi,
I am facing a problem while running a STL CPP application Compiled
using gcc in Solaris environment.
Following is the code :
#include <set>
{
template <class SerImp>
class Services
{
public:
void Add(SerImp *TOSer)
{
if (TOSer)
m_list.insert(TOSer);
}
void Remove(SerImp *TOSer)
{
m_list.erase(TOSer);
}
protected:
typedef std::set<SerImp*> SerL;
typedef SerL::iterator SerIter;
SerL m_list;
};
Whenever I try to do "m_list.insert(TOSer)" the application is
giving Segmentation fault.
This is the call stack.
#0 0xfef64ac8 in std::_Rb_tree_decrement (__x=0xff35356c)
at /rsft/users/akankari/gcc-3.4.2/libstdc++-v3/src/tree.cc:94
#1 0xff2839a8 in std::_Rb_tree_iterator<R::BaseSerImp*>:
perator--
(this=0xffbef3f0) at stl_tree.h:195
#2 0xff283434 in std::_Rb_tree<R::BaseSerImp*, R::BaseSerImp*,
std::_Identity<R::BaseSerImp*>, std::less<R::BaseSerImp*>,
std::allocator<R::BaseSerImp*> >::insert_unique (this=0xff353568,
__v=@0xffbef550) at stl_tree.h:877
#3 0xff282f08 in std::set<R::BaseSerImp*, std::less<R::BaseSerImp*>,
std::allocator<R::BaseSerImp*> >::insert (this=0xff353568,
__x=@0xffbef550) at stl_set.h:314
#4 0xff282bf0 in Services<R::BaseSerImp>::Add (this=0xff353568,
TOSer=0x246d8) at Services.h:48
Can anybody suggest what the reason for this Segmentation fault is? We
have to use any special switch while compiling this application because
the same application is working fine in windows?
Thanks,
Vinu
I am facing a problem while running a STL CPP application Compiled
using gcc in Solaris environment.
Following is the code :
#include <set>
{
template <class SerImp>
class Services
{
public:
void Add(SerImp *TOSer)
{
if (TOSer)
m_list.insert(TOSer);
}
void Remove(SerImp *TOSer)
{
m_list.erase(TOSer);
}
protected:
typedef std::set<SerImp*> SerL;
typedef SerL::iterator SerIter;
SerL m_list;
};
Whenever I try to do "m_list.insert(TOSer)" the application is
giving Segmentation fault.
This is the call stack.
#0 0xfef64ac8 in std::_Rb_tree_decrement (__x=0xff35356c)
at /rsft/users/akankari/gcc-3.4.2/libstdc++-v3/src/tree.cc:94
#1 0xff2839a8 in std::_Rb_tree_iterator<R::BaseSerImp*>:
(this=0xffbef3f0) at stl_tree.h:195
#2 0xff283434 in std::_Rb_tree<R::BaseSerImp*, R::BaseSerImp*,
std::_Identity<R::BaseSerImp*>, std::less<R::BaseSerImp*>,
std::allocator<R::BaseSerImp*> >::insert_unique (this=0xff353568,
__v=@0xffbef550) at stl_tree.h:877
#3 0xff282f08 in std::set<R::BaseSerImp*, std::less<R::BaseSerImp*>,
std::allocator<R::BaseSerImp*> >::insert (this=0xff353568,
__x=@0xffbef550) at stl_set.h:314
#4 0xff282bf0 in Services<R::BaseSerImp>::Add (this=0xff353568,
TOSer=0x246d8) at Services.h:48
Can anybody suggest what the reason for this Segmentation fault is? We
have to use any special switch while compiling this application because
the same application is working fine in windows?
Thanks,
Vinu