[PATCH v2] winedevice: Use WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR to free drivers in async_shutdown_drivers.

Jacek Caban jacek at codeweavers.com
Thu Feb 16 09:41:39 CST 2017


On 15.02.2017 17:46, Sebastian Lackner wrote:
> On 15.02.2017 17:07, Jacek Caban wrote:
>> +    wine_rb_clear( &wine_drivers, NULL, NULL );
> This fixes the issue, but passing a non-NULL callback to clear() would crash
> because the rbtree is temporarily corrupted. In all other places clear() is
> called to clear the content, not as a replacement for init().

Right. It not relevant here, but I actually think that wine_rb_clear
should not have callback argument.

> Wouldn't it make more sense to integrate the clearing directly into the macro
> somehow, if its only used for destructors? You could for example reset ->root
> immediately after initializating the cursor.

I like that idea. I will revisit the patch later.

> Otherwise, if the macro is supposed
> to be a general purpose postorder iterator, it would make more sense to use
> a different name.

No, it's not meant to be general purpose. I don't see any use case other
than freeing elements. Other use cases are covered by ordered iterators.


Thanks,
Jacek



More information about the wine-devel mailing list