Hi!
I am testing my app for symbian signed with LowMem tool. It is showing a
KERN-EXEC 3 panic when I execute the following code. PLease help with where
I am going wrong.
TBool CSomeClass::AppInstalled(const TDesC& aAppName)
{
_LIT(KSQLInstall,"SELECT Instal FROM App WHERE Name='%S'"😉;
TBuf<63>* installSQL=new(ELeave)TBuf<63>();
CleanupStack::PushL(installSQL);
installS QL->Format(KSQLInstall,&aAppName);
RDbView tmpView;
TInt retCode=tmpView.Prepare(iEngineDB,TDbQuery(*installSQL) );
CleanupStack::PopAndDestroy(installSQL);
if(retCode==KErrNone)
{
if(tmpView.Unevaluated())
tmpView.EvaluateAll();
while (tmpView.NextL())
{
tmpView.GetL();
if(tmpView.ColInt(1)==0)
{
tmpView.Clos e();
return ETrue;
}
else
{
tmpVi ew.Close();
return EFalse;
}
}
}
}
Thanks and Regards,
lalit
> I am testing my app for symbian signed with LowMem tool. It is showing a
> KERN-EXEC 3 panic when I execute the following code. PLease help with where
> I am going wrong.
I guess this should better go to c++ subgroup instead..
> TBool CSomeClass::AppInstalled(const TDesC& aAppName)
> {
> _LIT(KSQLInstall,"SELECT Instal FROM App WHERE Name='%S'"😉;
> TBuf<63>* installSQL=new(ELeave)TBuf<63>();
This could get easily overflowed.. see max app name length.
> CleanupStack::PushL(installSQL);
> installS QL->Format(KSQLInstall,&aAppName);
>
> RDbView tmpView;
You should use CleanupClosePushL() here (if NextL() leaves, there won't
be a proper cleanup)
> TInt retCode=tmpView.Prepare(iEngineDB,TDbQuery(*installSQL) );
> CleanupStack::PopAndDestroy(installSQL);
> if(retCode==KErrNone)
> {
> if(tmpView.Unevaluated())
> tmpView.EvaluateAll();
>
> while (tmpView.NextL())
> {
> tmpView.GetL();
> if(tmpView.ColInt(1)==0)
> {
> tmpView.Clos e();
> return ETrue;
>
> }
> else
> {
> tmpVi ew.Close();
> return EFalse;
> }
> }
> }
> }
>
>
> Thanks and Regards,
> lalit
>
>
--
David Caabeiro
www.PushL.com
> Hi!
Hi to you too.
> I am testing my app for symbian signed with LowMem tool. It is showing a
> KERN-EXEC 3 panic when I execute the following code. PLease help with
> where
> I am going wrong.
....
> _LIT(KSQLInstall,"SELECT Instal FROM App WHERE Name='%S'"😉;
> TBuf<63>* installSQL=new(ELeave)TBuf<63>();
Why allocate the descriptor dynamically? Just allocate big enough descriptor
from the stack. Or use HBufC instead.
> CleanupStack::PushL(installSQL);
> installS QL->Format(KSQLInstall,&aAppName);
>
> RDbView tmpView;
>
> TInt retCode=tmpView.Prepare(iEngineDB,TDbQuery(*installSQL) );
From TDbQuery documentation:
"
TDbQuery(const TDesC& aQuery,TDbTextComparison
aComparison=EDbCompareNormal);
Description
Constructs a query object from an SQL string and a text comparison mode.
Note that no copy is made of the descriptor passed; it is stored by
reference in the query object."
So when you pop and destroy the dynamically allocated descriptor, the
reference to the descriptor in TDbQuery becomes invalid.
> CleanupStack::PopAndDestroy(installSQL);
> if(retCode==KErrNone)
> {
> if(tmpView.Unevaluated())
....
> Thanks and Regards,
> lalit
Hope this helps.