Menu

#4 Crashing on exit

open
nobody
None
5
2001-08-11
2001-08-11
Anonymous
No

When my jabberclient is exited (for example by

Private Sub EndImage_Click()

JSession.Available = False
JSession.DoDisConnect False

End
End Sub

)

The whole IDE is dragged down by a crash...
Nothing I've tried helps to cure the problem...
When i first go offline, and then close the program,
it's all fine....

Discussion

  • Ben Gidley

    Ben Gidley - 2001-09-17

    Logged In: YES
    user_id=58658

    I am having this problem also. I would be interested to see
    what you send to 'go offline'. I cannot find an example of
    what should be done to stop this happening.

     
  • Nobody/Anonymous

    Logged In: NO

    I have had a similar problem and I think I found the
    solution. Before exiting your program do the following

    Public With Events JSession as JabberSession
    .
    .
    .
    'Just before the end of your program
    If JSession.Active Then JSession.DoDisconnect
    DoEvents

    Also, under no circumstances should you use the End
    function or the Stop button in the IDE. End does not allow
    normal termination such as Class_Terminate functions and
    for some reason JabberCOM is not shut down properly.

    Hope this helped.

     
  • john anderson

    john anderson - 2003-06-28

    Logged In: YES
    user_id=811562

    I was having this problem in vc++ and identified the problem
    as being the fact that when you call DoDisconnect(), the
    jabbercom framework will try to callback OnDisconnect(), but
    if the Session has aready been deleted then it will of course
    throw an exception. I was able to remedy the problem by
    creating a flag that keeps track of when OnDisconnect has
    been called. After I call DoDisconnect() I have an embedded
    message loop that waits around until my flag is FALSE.

    Here is a shoddy example from the destructor of the class
    containing the JabberSession:

    if (Session.GetActive())
    {
    Session.SetAvailable(false);
    Session.DoDisconnect(true);
    MSG msg;

    CWinApp *app=AfxGetApp();
    while(1)
    {
    if(JabberConnected=FALSE) break;
    while ( ::PeekMessage( &msg, NULL, 0, 0,
    PM_NOREMOVE ) )
    {
    if ( !app->PumpMessage( ) )
    {
    ::PostQuitMessage(1);
    break;
    }
    }
    // let MFC do its idle processing
    LONG lIdle = 0;
    while ( AfxGetApp()->OnIdle(lIdle++ ) );
    }

    }

     
  • john anderson

    john anderson - 2003-06-29

    Logged In: YES
    user_id=811562

    Oh, this is an addendum to my other post. On line 9 of my
    example it should read: JabberConnected==FALSE
    Also, you may need to add a Sleep(500); to your
    OnDisconnect() as it seems that jabbercom sometimes
    requires extra time to finish it's cleanup. This is definately a
    hack, but it seems to work.

     

Log in to post a comment.