[Gambas-user] Error during registration on the D-Bus

Hans Lehmann hans at gambas-buch.de
Sat Mar 10 18:32:46 CET 2018


Hello,

I try in vain to call my service program for the D-Bus only once.
At the first start I see the window and can use the service with a D-Bus 
client program.
After a further start I expect the inserted error message - instead 
there is an error message:

This application has raised an unexpected error and must abort.
Unique application is already registered.
DBus._RegisterApplication.78

With kind regards

Hans

FMain.class:

Public Sub Form_Open()

   DBus.Unique = True

   If DBus.IsRegistered(Service) Then
      Message.Error("An instance of " & Application.Name & " already 
exists.")
      FMain.Close()
   Else
      DBus.Session.Register(Service, "/Service")
   Endif

End

Public Sub Form_Close()

   If DBus.IsRegistered(Service) Then DBus.Session.Unregister(Service)
   FMain.Close()

End

--------------------------------------------------------------------------------------------------

Service.class:

Inherits DBusObject
Create Static

Public Function ComputeAdd(Value1 As Float, Value2 As Float) As Float
   Return Value1 + Value2
End


More information about the User mailing list