D23801: Port kpac from QtScript

Allan Sandfeld Jensen noreply at phabricator.kde.org
Thu Oct 31 17:19:53 GMT 2019


carewolf added inline comments.

INLINE COMMENTS

> kossebau wrote in script.cpp:316
> With queued signals, any const-reference arguments are passed via an internal value-copy IIRC, so references are not out-dated.
> Can the same technique not be expected with any usages of invocables, like from scripting engines?

Sure, as I said, I only write it this way because a copy should be taken, and while Qt can work around declaring an async argument as a reference, I still consider it bad style to make that mistake.

In any case the difference is basically academic when it comes reference counted Qt containers. You can save some nanoseconds on doing a reference pass when it isn't async, but I have wasted more time hunting down obscure bugs caused by using references in cross-thread methods in other frameworks, so I prefer this. Feel free to change it if you like though. As I said it is just a best practice/coding style for me, and not necessary for Qt invokables.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D23801

To: carewolf, dfaure
Cc: kossebau, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191031/ae839568/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list