Recent

Author Topic: LibreOffice events listener  (Read 6398 times)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11999
  • FPC developer.
Re: LibreOffice events listener
« Reply #15 on: January 04, 2025, 06:34:46 pm »
It seems that the problem is a small bug in the TAutoObject.GetTypeInfo function - should return DispTypeInfo instead of ClassInfo.

... and it works trunk commit ac510d391f9d784a00275836715a25a41331460f

thanks!

Still exceptions when closing (RPC server something) it seems.

Thaddy

  • Hero Member
  • *****
  • Posts: 16410
  • Censorship about opinions does not belong here.
Re: LibreOffice events listener
« Reply #16 on: January 04, 2025, 09:55:54 pm »
That is probably the same as with ms: you need to mask out all floating point exceptions, e.g, from memory Set8087CW  with $1332 controlword. This is only needed on Windows32, not on nixes or 64bit. If necessary on other platforms, use SetExceptionMask instead and don't forget to restore on exit.
« Last Edit: January 04, 2025, 10:04:52 pm by Thaddy »
There is nothing wrong with being blunt. At a minimum it is also honest.

korba812

  • Sr. Member
  • ****
  • Posts: 447
Re: LibreOffice events listener
« Reply #17 on: January 05, 2025, 12:45:40 am »
I can also see this message if I close LibreOffice before closing sample project. But this looks like a logic error of example project - in the FormClose event there is an attempt to operate on a LibreOffice instance that no longer exists.

chris_laz

  • New member
  • *
  • Posts: 7
Re: LibreOffice events listener
« Reply #18 on: January 06, 2025, 05:45:26 pm »
Brilliant, thanks guys. That has fixed it.

I suspected it was something simple like this, I just hadn't got as far as combing through the existing FPC source to double-check these things.

For the moment, rather than downloading a dev build of FPC, I've just re-implemented the TAutoObject in my LibreOfficeEventListener unit, with the required fix in the GetTypeInfo method:

Code: Pascal  [Select][+][-]
  1. function TAutoObjectBugFixed.GetTypeInfo(Index, LocaleID: longint; out TypeInfo): HResult; stdcall;
  2. begin
  3.    if Index<>0 then Result := DISP_E_BADINDEX
  4.    else begin
  5.       ITypeInfo(TypeInfo) := TAutoObjectFactory(Factory).DispTypeInfo; // bug fix for FPC 3.2.2, was returning ClassInfo
  6.       Result := S_OK;
  7.    end;
  8. end;
  9.  

Thanks again!

 

TinyPortal © 2005-2018