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

List:       kde-devel
Subject:    Re: About memory allocation failures....
From:       aleXXX <alexander.neundorf () gmx ! net>
Date:       2002-01-26 11:03:13
[Download RAW message or body]

On Saturday 26 January 2002 01:11, rcm wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
>
> 	Hi....
>
> 	if i ask for memory for say a KConfig object like this:
>
> 	kspk_config = new KConfig("kspeakerrc", false, false);
>
> 	then i check if the memory allocation succeded like this:
>
> 	if (!kspk_config) {
> 		KMessageBox::error(0, i18n("Can't allocate memory to open cofiguration
> file !!!!"), i18n("Kspeaker configuration error."));
> 		exit(EXIT_FAILURE);
> 	}
>
>
> 	But is this right ?? im inside either kcmshell or kcontrol, so i dont know
> if calling exit() is right....maybe yes if im inside kcmshell but inside
> kcontrol its not exactly correct....what if the right way of doing this ???

If allocating the memory fails, then you are in heavy trouble anyway.
Don't know what you could do in this situation except freeing some memory 
(e.g. exit kcontrol).

Bye
Alex
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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