Symbian classes which start with an R (e.g. RFs, RAknKeyLock, REikAppUiSession etc.) aren't safe.
=> This means you have to make them save by yourself to catch all exceptions.
The safe way for objects:
RClass object;
CleanupClosePushL(object);
User::LeaveIfError(object.Connect());
//your code here [...]
CleanupStack::PopAndDestroy(&object);
The safe way for object pointers:
RClass* object = RClass::NewLC();
User::LeaveIfError(object.Connect());
CleanupStack::PopAndDestroy(object);
(NewLC creates the object and pushes it on CleanupStack)
PopAndDestroy does close the connection to the server (from object.Connect()) automatically.
doing this without of exception handling can cause memory leaks and crash your app
Thanks Il.Socio for your help