×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    140

    when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with 66

    hello,

    I am using CnvUtfConverter::ConvertToUnicodeFromUtf8L to convert a 8-bit descriptor to 16-bit.
    My code is following:

    Code:
    		 TBuf8<1024> msgbuf;
    		 msgbuf.Format(_L8("%s"), message.c_str()); //here: std::string message;
    		 HBufC* msgbody = CnvUtfConverter::ConvertToUnicodeFromUtf8L(msgbuf);
    ...
                     delete msgbody;
    when I use CnvUtfConverter::ConvertToUnicodeFromUtf8L in my main thread, it works fine, but when the above segment of code is called in my sub-thread, it will cause the sub-thread exit with panic 66.

    why does it happen? Could anybody please help me? thanks first.

  2. #2
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    Hi,

    I you got a "E32USER-CBase 66" panic that means you should create the Cleanup Stack for the new thread.

    Code:
    // in the ThreadFunc()
    ...
    		// Cleanup stack needed
    		CTrapCleanup* cleanup = CTrapCleanup::New();
    		if(cleanup)
        			{
    			TRAPD(err, ThreadFuncL());
    			if(err != KErrNone)
    				{
    				// handle the error
    				}
    			delete cleanup;
        			}
    		}
    ...
    
    // in the ThreadFuncL() call your CnvUtfConverter::ConvertToUnicodeFromUtf8L() code
    Regards

    Ziteng Chen

  3. #3
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    Yes "E32USER-CBase 66" for missing cleanup stack. But if i am not wrong than simple CnvUtfConverter::ConvertToUnicodeFromUtf8L() can not require cleanup stack.

    @yfw1966: Are you sure that code you posted is the only reason for panic??

  4. #4
    Registered User
    Join Date
    Mar 2008
    Posts
    140

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    yes, But actually I have created CTrapCleanup in my sub-thread first with the same code:
    CTrapCleanup* cleanup = CTrapCleanup::New();
    ...
    delete cleanup;

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    140

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    exactly speaking, everywhen calling this line "HBufC* msgbody = CnvUtfConverter::ConvertToUnicodeFromUtf8L(msgbuf);" , the sub-thread will exit, and notify the main thread at the same time. the exit value received by main thread is "iStatus = 66".

    I have tested many times, I am sure it is not caused by the CTrapCleanup. but why does it happen? is there any special set in this function?

  6. #6
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    Quote Originally Posted by savaj View Post
    Yes "E32USER-CBase 66" for missing cleanup stack. But if i am not wrong than simple CnvUtfConverter::ConvertToUnicodeFromUtf8L() can not require cleanup stack.
    Hi,

    Pity that you are wrong. UIQ3 SDK has symbols so we can step into system functions, from attached call stack snapshot we can see the CnvUtfConverter::ConvertToUnicodeFromUtf8L() is actually using Cleanup Stack.

    Regards

    Ziteng Chen
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by chenziteng; 2009-07-27 at 12:34. Reason: to upload the UIQ3 example app

  7. #7
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    Quote Originally Posted by yfw1966 View Post
    exactly speaking, everywhen calling this line "HBufC* msgbody = CnvUtfConverter::ConvertToUnicodeFromUtf8L(msgbuf);" , the sub-thread will exit, and notify the main thread at the same time. the exit value received by main thread is "iStatus = 66".

    I have tested many times, I am sure it is not caused by the CTrapCleanup. but why does it happen? is there any special set in this function?
    Hi,

    Then you should use TRAP macro to trap the leaving function as I did in the sample code.

    See also the attached examples, one of them can reproduce your problem and another shows how to solve it.

    Regards

    Ziteng Chen
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    Mar 2008
    Posts
    140

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    thanks for your suggestion.
    But 1)even if the TRAPD is used in the sub-thread, the sub-thread is unavoidable to receive an panic when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L yet; 2)when calling this line code 'HBufC* temp = HBufC::NewL(1024);', the sub-thread won't recevie the panic, so I do not think it is caused by cleanupstack.

    I have seen the project, but I can not compile it with my IDE, so could you tell me if the function "CnvUtfConverter::ConvertToUnicodeFromUtf8L" works fine when you run it? thanks.

    In addition, could you please tell me the implementation of ConvertToUnicodeFromUtf8L? thanks.

  9. #9
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L, the sub-thread exit with

    Quote Originally Posted by yfw1966 View Post
    thanks for your suggestion.
    But 1)even if the TRAPD is used in the sub-thread, the sub-thread is unavoidable to receive an panic when calling CnvUtfConverter::ConvertToUnicodeFromUtf8L yet; 2)when calling this line code 'HBufC* temp = HBufC::NewL(1024);', the sub-thread won't recevie the panic, so I do not think it is caused by cleanupstack.

    I have seen the project, but I can not compile it with my IDE, so could you tell me if the function "CnvUtfConverter::ConvertToUnicodeFromUtf8L" works fine when you run it? thanks.

    In addition, could you please tell me the implementation of ConvertToUnicodeFromUtf8L? thanks.
    Hi,

    The HelloWorld(NoProblem).zip sample code works find on S60 5th Edition emulator (I'm using Carbide.c++ 2.02).

    "HBufC::NewL();" is supposed to work without Cleanup Stack because it has no -C suffix, I don't know the implmentation of CnvUtfConverter::ConvertToUnicodeFromUtf8L() neither just saw from the call stack that it calls HBufC::NewLC().

    A panic is identified by a category (like "KERN-EXEC" or "EUSER-CBase") and a number, so what exactly your panic cateotry & number are?

    Regards

    Ziteng Chen

Similar Threads

  1. [moved] Cannot run the S60 5th ed Emulator (tagma.dll assertion)
    By Carbider in forum Symbian Tools & SDKs
    Replies: 20
    Last Post: 2010-06-07, 17:21
  2. exit() and _Exit() for multi thread Open C app
    By kcomex in forum Open C/C++
    Replies: 3
    Last Post: 2009-04-20, 14:40
  3. Replies: 6
    Last Post: 2007-03-01, 18:19
  4. System crash while calling insertL() from another thread
    By matlev in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-02-28, 18:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×