Skip to content
  • Markus Armbruster's avatar
    6c2f9a15
    qapi: Make output visitor return qnull() instead of NULL · 6c2f9a15
    Markus Armbruster authored
    
    
    Before commit 1d10b445, it crashed.  Since then, it returns NULL, with
    a FIXME comment.  The FIXME is valid: code that assumes QObject *
    can't be null exists.  I'm not aware of a way to feed this problematic
    return value to code that actually chokes on null in the current code,
    but the next few commits will create one, failing "make check".
    
    Commit 481b002c solved a very similar problem by introducing a special
    null QObject.  Using this special null QObject is clearly the right
    way to resolve this FIXME, so do that, and update the test
    accordingly.
    
    However, the patch isn't quite right: it messes up the reference
    counting.  After about SIZE_MAX visits, the reference counter
    overflows, failing the assertion in qnull_destroy_obj().  Because
    that's many orders of magnitude more visits of nulls than we expect,
    we take this patch despite its flaws, to get the QMP introspection
    stuff in without further delay.  We'll want to fix it for real before
    the release.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarDaniel P. Berrange <berrange@redhat.com>
    Message-Id: <1442401589-24189-21-git-send-email-armbru@redhat.com>
    6c2f9a15
    qapi: Make output visitor return qnull() instead of NULL
    Markus Armbruster authored
    
    
    Before commit 1d10b445, it crashed.  Since then, it returns NULL, with
    a FIXME comment.  The FIXME is valid: code that assumes QObject *
    can't be null exists.  I'm not aware of a way to feed this problematic
    return value to code that actually chokes on null in the current code,
    but the next few commits will create one, failing "make check".
    
    Commit 481b002c solved a very similar problem by introducing a special
    null QObject.  Using this special null QObject is clearly the right
    way to resolve this FIXME, so do that, and update the test
    accordingly.
    
    However, the patch isn't quite right: it messes up the reference
    counting.  After about SIZE_MAX visits, the reference counter
    overflows, failing the assertion in qnull_destroy_obj().  Because
    that's many orders of magnitude more visits of nulls than we expect,
    we take this patch despite its flaws, to get the QMP introspection
    stuff in without further delay.  We'll want to fix it for real before
    the release.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarDaniel P. Berrange <berrange@redhat.com>
    Message-Id: <1442401589-24189-21-git-send-email-armbru@redhat.com>
Loading