USER 0

Login to reply to this topic.
Wed, 2005-01-26 06:46
Joined: 2004-09-06
Forum posts: 349
What does the panic USER 0 mean? The docs says the following

Quote
This panic is raised when a thread calls User::Invariant().

Typically, User::Invariant() is called when a test for a class invariant fails, i.e. when a test which checks that the internal data of an object is self-consistent, fails.

Check the design and implementation of your class.

What does "internal data of an object is selfconsistent" mean? What object? What could be wrong? I hope the answer to this isn't "anything"...

In my program I get this error the second time I go through the same code. I feel that is strange.... Another strange thing is that it doesn't seem to happen regularly...   Huh

I also found (http://www.symbian.com/developer/techlib/v70sdocs/doc_source/reference/cpp/SystemStaticFunctions/UserClass.html) that:

Code:
Such tests are almost always done in debug builds, commonly using the __ASSERT_DEBUG macro.

However, I have no __ASSERT_DEBUG macro in my code.

Wed, 2005-01-26 09:28
Joined: 2004-07-28
Forum posts: 1379
USER 0
Alas... That is indeed the anwser... Anything Smiley

Most people should do tests with something like this:

__ASSERT_DEBUG(iState == EThisState, User::Panic("A FRIENDLY CAT NAME", A USEFUL NUMBER);

So you can get more info.

Some lazy people (and it's a few places in the OS!) do this:

__ASSERT_DEBUG(iState == EThisState, User::Invariant());

Which gives you no clue at all to whats going on Smiley

Your only bet is to find the line thats raising it ..

didster

Wed, 2005-01-26 11:02
Anonymous (not verified)
Forum posts: 2043
USER 0
ASSERT macro is also defined, this calls the Invariant version didster mentioned above.
Wed, 2005-01-26 18:25
Joined: 2004-09-06
Forum posts: 349
USER 0
Thanks you both,

It seems like my USER 0 panic occurs not the first, but the second time the following code is run. I don't know how to solve this problem.

Code:
CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(aBody);
dlg->PrepareLC(R_DIALOG_POPUP_MESSAGE);
dlg->QueryHeading()->SetTextL(aTitle);
dlg->RunLD(); //<---Just after this dialog is displayed the second time, USER 0 panic happens
Thu, 2005-01-27 08:50
Joined: 2004-07-28
Forum posts: 1379
USER 0
Alas, that could be a bit of a read hearing.  If CAknMessageQueryDialog is a waiting dialog, then RunLD will enter it's own scheduler loop.  So basically, it could be any active object which happens to compelete when that RunLD is running Smiley

didster

Thu, 2005-01-27 09:21
Joined: 2004-09-06
Forum posts: 349
USER 0
Thanks didster!

Ok... when you mention it I put a breakpoint in DoCancel and fount out that it is not run even though I have called Cancel();. I guess it should call DoCancel - right?

It doesn't seem to matter how long time I wait... the panic comes exactly on the same place in the code anyway. If I don't misunderstand this the panic will come when the active object completes, which is a matter of time - or am I wrong?
Thu, 2005-01-27 09:36
Joined: 2004-07-28
Forum posts: 1379
USER 0
DoCancel will only be run if the active object is active.  Basically, Cancel looks like this:

if(IsActive())
{
DoCancel();
User::WaitForRequest(iStatus);
}

Does Cancel() return?

Well, we can't really say when it will happen, cause we don't really know whats causing it yet.

didster

Thu, 2005-01-27 09:49
Joined: 2004-09-06
Forum posts: 349
USER 0
Yes, Cancel() returns since the line under is a call to the function which displays the dialog, and I can see that dialog flashing by before the panic comes.
Thu, 2005-01-27 09:55
Joined: 2004-07-28
Forum posts: 1379
USER 0
Ok.  In what function of this AO are you calling Cancel and creating the dialog?

Not the desctuctor I hope!

If you can't figure it out, email me it (sure you still have my address) with an expliation of where it is, and how to get there, and ill have a look

didster

Thu, 2005-01-27 10:37
Joined: 2004-09-06
Forum posts: 349
USER 0
No.. it is not in the destructor. I'm using sockets. I have taken some of the code from an example coming with the SDK. There is a SocketsReader, SocketsWriter, and a SocketsEngine. I make the call in the RunL method of the SocketsReader, but as I understand that will have no use. But when I call it, there should be no more outstanding request for this AO...

Code:
void CSocketsReader::RunL()
{
   switch (iStatus.Int()) {
case KErrNone:
{// Character has been read from socket
           
if (iBuffer_tmp.Length() > 0) {
iBuffer.Append(iBuffer_tmp);
iBuffer_tmp.Zero();
}

IssueRead(); // Immediately start another read
           break;
}
case KErrDisconnected:
{
iEngineNotifier.ReportError(MEngineNotifier::EDisconnected, iStatus.Int());
break;
}
case KErrEof:
{
if (iBuffer_tmp.Length() > 0) {
iBuffer.Append(iBuffer_tmp);
iBuffer_tmp.Zero();
}

iEngineNotifier.ResponseReceived(iBuffer);
Cancel();

break;
}
default:
{
iEngineNotifier.ReportError(MEngineNotifier::EGeneralReadError, iStatus.Int());
break;
}
}
}

void CSocketsEngine::ResponseReceived(const TDesC8& aBuffer)
{
iTimer->Cancel();

if (iGlobalProgressDialog) {
iGlobalProgressDialog->UpdateProgressDialog(iRequestSize, iRequestSize);
User::After(200000);
iGlobalProgressDialog->ProcessFinished();
}

...

if (iConsole.CurrentRequest() == ERetreiveCreditCmd) { //Credit status was requested
HBufC* cr = HBufC::NewL(creditsLeftBuf->Length());
cr->Des().Copy(creditsLeftBuf->Des());
HBufC* fr = HBufC::NewL(freebiesLeftBuf->Length());
fr->Des().Copy(freebiesLeftBuf->Des());
TLex lex(cr->Des());
TInt credit = -1;
TInt freebies = -1;
lex.Val(credit);
lex.Assign(fr->Des());
lex.Val(freebies);
iConsole.CreditReceived(credit, freebies);
} else { //It is a vCard
...
}
Disconnect();
}

void CSocketsEngine::Disconnect()
{
if (iGlobalProgressDialog) {
iGlobalProgressDialog->ProcessFinished();
}

// cancel all outstanding operations
   // since we are connected, the only possibilities are read and write
iSocketsReader->Cancel();
   iSocketsWriter->Cancel();

iSocket.Close();
isDisconnecting = EFalse;
ChangeStatus(ENotConnected);
}



I have also sent you an e-mail.

Kindest Regards,
Joachim
Thu, 2005-02-10 07:10
Joined: 2004-07-12
Forum posts: 8
Resurrection of the topic:)
I wonder if you have come to any conclusion. I am having exactly the same problem, I am writing some app which uses socketsengine from sockets example from s60 examples and when I try to launch dialog in the AppUi HandleCommandL I get the User 0 error.
Thu, 2005-02-10 08:36
Joined: 2004-07-28
Forum posts: 1379
USER 0
You say you have sent me an email?

I havent had one..

didster

Thu, 2005-02-10 15:35
Joined: 2004-07-12
Forum posts: 8
I have identified the code which causes the error
I have identified the code which causes the problem. Unfortunately I am not able to find out the inconsistency error.

My problem is caused by the dialog code:
from RSS ...

RESOURCE DIALOG r_simpledlg_player_name_dialog
   {
   flags=EAknDialogSelectionList;
   buttons=R_AVKON_SOFTKEYS_OK_CANCEL;
   items=
      {
      DLG_LINE
         {
         id=ESimpleDlgCIdPlayerName;      
         type=EAknCtSingleListBox;
         control= LISTBOX
            {
            flags=EAknListBoxSelectionList;
            };
         }         
      };

   }

from HandleCommandL from AppUi:

CDesCArray* tempArray=new (ELeave) CDesC16ArrayFlat(10);
_LIT (KStringHeader, "0\tSaved Game %d");
TBuf <16> aString;
for (TInt i = 1; i< 11; i++)
{
   aString.Format(KStringHeader(), i);
   tempArray->AppendL (aString);
}

TInt openedItem(0);

CAknSelectionListDialog* dialog = CAknSelectionListDialog::NewL(openedItem, tempArray, 0);
dialog->PrepareLC (R_SIMPLEDLG_PLAYER_NAME_DIALOG);
// Execute the dialog
dialog->RunLD ()
         
If anybody see the problem please help. I do not see any inconsistency:(.
Mon, 2006-01-02 16:50
Joined: 2005-07-04
Forum posts: 19
Re: USER 0
Hello

Did you find the solution to this problem? I am getting the same error with similiar code.

It would be very nice if you could share the soloution if you have it.

Thanx.


Fri, 2007-04-27 14:33
Joined: 2005-02-11
Forum posts: 10
Re: USER 0
Wed, 2008-07-09 13:19
Joined: 2008-02-06
Forum posts: 2
Re: USER 0

Hi,

I am facing USER 0 for multi line data query dialog.

Can anyone suggest what is the problem ?

Yes in background there is a running active object so if it is the problem then what I have to do for that AO ?

Regards,
Kavit.

  • Login to reply to this topic.