Mir

Code review comment for lp:~alan-griffiths/mir/improve-tidy-up-of-mir_connection_get_display_info

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> I think this is a step backwards. The first hint is the increase in code size
> (+19/-9). But more importantly, this is difficult to read:
> unique_with_deleter. Much more difficult to read than the
> "mir_display_config_destroy(config)" you're aiming to replace. I would rather
> keep the code readable with mir_display_config_destroy.

You're missing that it fixes the leaks caused by "return" statements that bypass that call. Alternative fixes also add lines.

> RAII is not useful if it results in code that's less clear about the
> possibility of leaks than that which it replaces. And I think
> mir_connection_get_display_info is presently very clear on the lifetime of
> config.

A RAII version was requested by Thomas and Alf - an alternative fix (that I was happy) with has already landed.

« Back to merge proposal