Skip to content

Fix qdbusxml2cpp crash due to annotation type.

Michael Pyne requested to merge work/mpyne/fix-libdbusmenu-xml-annotation into master

When building in qt6 mode I get an error from qdbusxml2cpp which boils down to:

[103/164] Generating dbusmenuadaptor.cpp, dbusmenuadaptor.h
FAILED: src/dbusmenuadaptor.cpp src/dbusmenuadaptor.h dbusmenuadaptor.cpp dbusmenuadaptor.h
/home/kde-svn/qt6/bin/qdbusxml2cpp -m -a dbusmenuadaptor -i src/libdbusmenu-qt/dbusmenuexporterdbus_p.h -l DBusMenuExporterDBus src/libdbusmenu-qt/com.canonical.dbusmenu.xml
src/libdbusmenu-qt/com.canonical.dbusmenu.xml:321:5: warning: Unknown element 'd' while checking for signal arguments
src/libdbusmenu-qt/com.canonical.dbusmenu.xml:327:68: error: Invalid Interface specification
src/libdbusmenu-qt/com.canonical.dbusmenu.xml:327:68: error: XML error: Unexpected '<'.

The line in question is (erroring on "<type">):

    <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="<type>"/>

I suspect this is due to upcoming Qt 6.7's qdbusxml2cpp getting stricter because this seemingly must have worked earlier, but I just updated Qt 6 today and instantly ran into this. The specific problem seems to be that "<type>" is meant to be filled in with an actual C++ type -- if I remove the annotation entirely then qdbusxml2cpp instead tells me an annotation is missing and the error message suggests to add that line.

In this case it wasn't meant to be taken entirely literally, I suspect, but to have replaced with an appropriate type. I don't know what the types are supposed to be, but there are 2 nearby annotations flagged as input types that seem to be the right shape.

So my fix for this is to remove the annotation entirely and replace the 2 existing annotations which appear to be improperly flagged as input types as output types instead. I suspect this was a bug from when these annotations were first introduced since signals cannot receive input.

This change makes qdbusxml2cpp happy and lets knotifications complete building. But note that I haven't managed to test yet, I'm still in the midst of setting up my first Qt6/KF6-based Plasma environment.

Merge request reports