[Kstars-devel] kdeedu/kstars/kstars

Jasem Mutlaq mutlaqja at ikarustech.com
Fri Jun 18 08:59:58 CEST 2004


On Thursday 17 June 2004 11:51 pm, Jason Harris wrote:
> CVS commit by harris:
>
> I was about to send a message to kde-devel about our KNewStuff crash,
> when I realized the solution.  The slotDownload() function has this
> line:
>
> 	if (!kns) kns = new KSNewStuff( this );
>
> But the kns pointer was never explicitly initialized to NULL (0), so
> it's not guaranteed to be NULL at startup.  I don't know why starting
> from the command line produced a different result from starting from the
> K menu, but I fixed the problem by initializing kns(0) in the KStars
> ctor.

Forgetting to initialize pointers to NULL caused me so many problems before 
that I literally have a post-it note on the wall behind the PC that says 
"DON'T FORGET TO INITIALIZE POINTERS TO NULL". !! :-)

Also, another tip: explicity delete anything that's not a child of QObject, 
and then after deleting, set the pointer to NULL.

cheers,
Jasem


More information about the Kstars-devel mailing list