[Kde-games-devel] Valgring Uninitialised value error in KTron

legolas at legolasweb.nl legolas at legolasweb.nl
Mon Jan 5 00:31:45 CET 2009


Hello,

This problem is now solved, with help of Albert Astals Cid.

These errors occured, because KGameDifficulty::init() was called later
than the first usage of it. This happened because there was a call
(loadSettings()) within the constructor in Tron, which was constructed
before the KGameDifficulty initialization and used KGameDifficulty.

I've moved the loadSettings to the end of the KTron constructor, which
fixed the problem.

Stas Verberkt


Quoting legolas at legolasweb.nl:

> Hi all,
>
> I've been running the application I maintain, KTron (in playground),
> through Valgrind.
>
> In the output I could find the following uninitialised value error:
>
> ==11634== Conditional jump or move depends on uninitialised value(s)
> ==11634==    at 0x8056188: Tron::lineSpeed() (tron.cpp:632)
> ==11634==    by 0x8056AAE: Tron::reset() (tron.cpp:157)
> ==11634==    by 0x8056FDF: Tron::loadSettings() (tron.cpp:81)
> ==11634==    by 0x80572E4: Tron::Tron(QWidget*) (tron.cpp:73)
> ==11634==    by 0x8059519: KTron::KTron(QWidget*) (ktron.cpp:60)
> ==11634==    by 0x805D60A: main (main.cpp:74)
>
> The actual line 632 in tron.cpp says:
>
> switch (KGameDifficulty::level()) {
>
> A statement which I've also seen in other KDEGames and I think is correct.
>
> I'm not really sure if I'm doing something wrong, or this is a glitch
> in Valgrind. Is there someone able to help me out here?
>
> Thanks in advance,
>
> Stas Verberkt
>
> _______________________________________________
> kde-games-devel mailing list
> kde-games-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-games-devel
>





----- End forwarded message -----




More information about the kde-games-devel mailing list