I have some question about RThread.
For example, in my program I create new thread in AppUI class:
code of thread_func is:Code:iThread.Create(_L("ThreadName"), thread_func, KDefaultStackSize, NULL, this); iThread.Resume();
In my AppView I have CEikEdwin and function AddText which adds string to this edwin.Code:TInt CTestThreadAppUi::thread_func(TAny* aPtr) { CTrapCleanup* cleanupStack = CTrapCleanup::New(); TRAPD(err, ((CTestThreadAppUi*)aPtr)->run_test()) delete cleanupStack; cleanupStack = NULL; return err; } void CTestThreadAppUi::run_test() { CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler(); CleanupStack::PushL(activeScheduler); CActiveScheduler::Install(activeScheduler); iAppView->AddText( _L("Hello") ); CleanupStack::PopAndDestroy(); //activeScheduler }
This function works then I call it from AppUI directly, but if I call if from my RThread this function throws panic KERN-EXEC 0 in stringCode:void CTestThreadAppView::AddText(const TDesC& aText) { CPlainText* text = iEdwin->Text(); text->InsertL( text->DocumentLength(), aText ); text->InsertL( text->DocumentLength(), CEditableText::ELineBreak ); iEdwin->HandleTextChangedL(); iEdwin->SetSelectionL( text->DocumentLength(), text->DocumentLength() ); iEdwin->SetFocus( ETrue ); DrawNow(); }In my test there are no any other threads.Code:iEdwin->HandleTextChangedL();

Reply With Quote


