[I originally sent this request to [email protected] but did not
receive a response, so I'm hoping that I'll have more success with this
mailing list.]

Hello!

I am working on a plug-in that controls a running slideshow with the
XPresentation2 interface. The problem I am having is that
occasionally, when I call end() on it, OO freezes -- never returning
from JNI_proxy.dispatch_call(). Initially I thought this might be due
to not calling the API from the correct thread, so I updated the code
to run on an XRequestCallback to ensure that I am executing end() on
the UNO main thread. My code is that calls end() is as follows:

=============================================================
 private void ClosePresentationWindow()
   {
      if ( !m_session.IsFullscreenWindowDisposed() )
      {
         m_session.SetFullscreenWindowDisposed( true );

         // Run from OO UI thread
         DesktopTools.RequestAnonymousCallback( new XCallback()
         {

            @Override
            public void notify( Object arg0 )
            {
               m_session.GetPresentation().end();      // HANG (sometimes)
            }

         } );
      }
   }
=============================================================

And RequestAnonymousCallback() looks like this:

=============================================================
public static boolean RequestAnonymousCallback( XCallback callback )
   {
      XContextWrapper xCtxWrapper = GetContext();
      if ( !xCtxWrapper.IsValid() )
         return false;

      try
      {
         XRequestCallback xRequestCallback = AsyncCallback.create(
xCtxWrapper
               .GetContext() );
         if ( xRequestCallback != null )
         {
            xRequestCallback.addCallback( callback, null );

            return true;
         }
      }
      catch ( RuntimeException e )
      {
         // do nothing
      }

      return false;
   }
=============================================================

Unfortunately, this does not seem to fix the problem, and so I am left
with OO crashing hard on an unpredictable basis. Does anyone have any
thoughts on this?

-- Cameron

Reply via email to