Hi everybody,

while working on the single instance code, I encountered the
following error when the second instance exited:

*** glibc detected *** free(): invalid pointer: <memory address> ***

I investigated the problem using valgrind (just discovered
this tool... powerful), which told me the exact place in the
code (after recompiling SciTE with -g), where it reported
both "Conditional jump or move depends on uninitialised value"
and "Invalid free". This probably never came to light before
because we were using exit() and the destructors were never
called.

This is the patch, we just need to initialise stack in the class
BufferList in SciTEBuffers.cxx:

diff -a -u -r1.159 SciTEBuffers.cxx
--- SciTEBuffers.cxx    13 Jun 2007 14:09:10 -0000      1.159
+++ SciTEBuffers.cxx    1 Jul 2007 20:23:37 -0000
@@ -74,7 +74,7 @@
        flags = 0;
 }

-BufferList::BufferList() : current(0), stackcurrent(0), buffers(0), size(0), 
length(0), initialised(false) {}
+BufferList::BufferList() : current(0), stackcurrent(0), stack(0), buffers(0), 
size(0), length(0), initialised(false) {}

 BufferList::~BufferList() {
        delete []buffers;

Nicolas

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to