KFileItemActions - why does it remember the actions it created, and deletes them?

Frank Reininghaus frank78ac at googlemail.com
Sat Jan 4 13:51:52 GMT 2014


Hi David,

2013/12/30 David Faure:
> On Friday 13 December 2013 11:28:01 Frank Reininghaus wrote:
[...]
>> Still, I'm wondering if KFileItemActions should really delete all
>> actions it created, even if they belong to a widget that has been set
>> with setParentWidget(QWidget*). It works fine if KFileItemActions is
>> destroyed *before* the widget, because parent QObjects listen to the
>> 'destroyed' signal, but if the destruction order is different for some
>> reason, then we might get a crash because we try to delete dangling
>> pointers, right?
>
> Right.
>
> I think the parent for the actions should be the KFileItemActions instance
> instead. That would make all use cases happy, and follow the principle of
> least surprise, right?

yes, that sounds reasonable! Should we then remove the

void setParentWidget(QWidget *widget)

member in frameworks, or better make it a no-op and deprecate it in
order to not break source compatibility?

Regards,
Frank




More information about the kfm-devel mailing list