News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Small patches resulting from valgrind

Started by neroden, July 02, 2013, 07:51:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neroden

I've been running valgrind on experimental to attempt to track down some memory corruption errors.  I've been patching everything I find.  A few of the patches should be applied to standard as well.  This will contain them.  First one is a tiny patch to simmain.


Dwachs

I have never got a valgrind warning at this point. How did you trigger it?
Parsley, sage, rosemary, and maggikraut.

neroden

By turning on optimization flags, I think. 

This is a real bug.  The problem is that ev is an uninitialized variable under certain circumstances, namely when the modal dialogue disappears really really fast and you never make it into either of the main loops up above.

Ters

Is there any way for a modal dialog to immediately disappear without inputs other than quit returning true from the start? If not, it might be better to just wrap the entire contents of the function in an if checking quit(). Reading input just to initialize a variable doesn't feel right.

Dwachs

Imho we should just initialize all member variables of event_t in its constructors.
Parsley, sage, rosemary, and maggikraut.

prissi

This sound also like the best solution for me.

Dwachs

Parsley, sage, rosemary, and maggikraut.