Hi Chris,<div><br></div><div>Thanks for the reply.</div><div><br></div><div>However, the error occurs even if I don't do anything, that is, even if I simply import the library and exit() after that. </div><div><br></div>

<div>I created a file a.py whose contents were the following:</div><div><br></div><div>import pyossim</div><div>exit()</div><div><br></div><div>Upon execution, the log was as follows: </div><div><br></div><div><div>vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$ python a.py </div>

<div>Segmentation fault</div><div><br></div><div>Following was the gdb log:</div><div><br></div><div>vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$ gdb `which python`</div><div>GNU gdb (GDB) 7.2-ubuntu</div><div>Copyright (C) 2010 Free Software Foundation, Inc.</div>

<div>License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>></div><div>This is free software: you are free to change and redistribute it.</div><div>

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"</div><div>and "show warranty" for details.</div><div>This GDB was configured as "i686-linux-gnu".</div><div>For bug reporting instructions, please see:</div>

<div><<a href="http://www.gnu.org/software/gdb/bugs/">http://www.gnu.org/software/gdb/bugs/</a>>...</div><div>Reading symbols from /usr/bin/python...(no debugging symbols found)...done.</div><div><br></div><div>(gdb) run a.py </div>

<div>Starting program: /usr/bin/python a.py</div><div>[Thread debugging using libthread_db enabled]</div><div><br></div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>0x00000029 in ?? ()</div><div><br>

</div><div>(gdb) bt</div><div>#0  0x00000029 in ?? ()</div><div>#1  0x0171de9f in OpenThreads::Mutex::~Mutex() () from /usr/lib/libOpenThreads.so.13</div><div>#2  0x0035369e in ?? () from /lib/libc.so.6</div><div>#3  0x0035370f in exit () from /lib/libc.so.6</div>

<div>#4  0x080fc854 in ?? ()</div><div>#5  0x080fcdf5 in ?? ()</div><div>#6  0x080fdc9b in PyRun_SimpleFileExFlags ()</div><div>#7  0x0805b6d3 in Py_Main ()</div><div>#8  0x0805a8ab in main ()</div><div><br></div><div>(gdb) </div>

</div><div><br></div><div>Regards, </div><div>Vipul Raheja</div><div><br></div><div><br><div class="gmail_quote">On Sat, Aug 6, 2011 at 4:32 PM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Sat, Aug 6, 2011 at 11:35 AM, Vipul Raheja <<a href="mailto:vipul.iiith@gmail.com">vipul.iiith@gmail.com</a>> wrote:<br>


> Hi,<br>
><br>
> I have wrapped a library from C++ to Python using SWIG. But when I<br>
> import it in Python, I am able to work fine with it, but it gives a<br>
> segmentation fault while exiting. Following is the log:<br>
<br>
</div>The most likely cause of this is that you DECREF'd an object when you<br>
shouldn't have, or failed to INCREF one when you should have. Check<br>
over your object usage; if you can narrow down the "Do some stuff" bit<br>
to the one function call that causes the crash, it'll help you figure<br>
out where the error is.<br>
<br>
Hope that helps!<br>
<br>
Chris Angelico<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br></div>