Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86867

Redefine the basic DBus types

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: P0: Blocker P0: Blocker
    • None
    • 5.15.0
    • D-Bus
    • None
    • Linux/Wayland

      As right now it is not possible to define the DBus type of custom types as the basic DBus types.

      This is extremely problematic especially treating enums and QList<QString> or other custom types which may collide with QtDBus predefined types.

      Imagine the following pseudo-code:

       enum Type {
              E1 = 0,
              E2 = 1,
              E3 = 2
      };
      qDBusRegisterMetaType<Type>();
      
      inline const QDBusArgument& operator<<(const QDBusArgument &argument, Type &source)
      {
          argument << static_const<int> source;
          return argument;
      }
      
      inline const QDBusArgument& operator<<(const QDBusArgument &argument, Type &source) 
      {
       int tmp;
       argument >> tmp; 
       source = static_const<Type> tmp; 
       return argument;
      }
      

      This snippet cause segmentation fault in dbus lib since the no signature is generated for the type with following warning from Qt.

      QDBusMarshaller: type `Type' attempts to redefine basic D-BUS type 'i' (int) (Did you forget to call beginStructure() ?)
      

      I think it should be perfectly fine to be able to do the above code. The same about other types which one may want to reuse the basic DBus types to represent.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            roamer Mostafa Emami
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes