[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] Uninitialised variable produced by kconfig_compiler
From:       David Jarvie <djarvie () kde ! org>
Date:       2009-06-21 21:20:41
Message-ID: 200906212220.41741.djarvie () kde ! org
[Download RAW message or body]

On Sunday 21 June 2009 20:07:58 you wrote:
> Le Sunday 21 June 2009, David Jarvie a écrit :
> > If signals are defined, kconfig_compiler includes the mSettingsChanged
> > member in the generated class, but it doesn't initialise it. Running
> > valgrind shows an uninitialised mSettingsChanged variable being used in
> > the tests in usrWriteConfig(). The attached patch fixes this. OK to
> > commit?
>
> Does this works when there is a d pointer?
> It doesn't seems so.

I attach a revised patch which takes care of the d pointer case.

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm


["kcc.diff" (text/x-patch)]

Index: kdecore/kconfig_compiler/kconfig_compiler.cpp
===================================================================
--- kdecore/kconfig_compiler/kconfig_compiler.cpp	(revision 977970)
+++ kdecore/kconfig_compiler/kconfig_compiler.cpp	(working copy)
@@ -1873,10 +1873,17 @@
      cpp << "  , mParam" << (*it).name << "(" << (*it).name << ")" << endl;
   }
 
+  if ( hasSignals && !dpointer )
+    cpp << "  , " << varName("settingsChanged") << "(0)" << endl;
+
   cpp << "{" << endl;
 
   if (dpointer)
+  {
     cpp << "  d = new " + className + "Private;" << endl;
+    if (hasSignals)
+      cpp << "  " << varPath("settingsChanged") << " = 0;" << endl;
+  }
   // Needed in case the singleton class is used as baseclass for
   // another singleton.
   if (singleton) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic