Crash fix for KParts::PartManager

Thomas Zander zander at kde.org
Tue Feb 20 10:02:26 GMT 2007


On Monday 19 February 2007 01:25, Andreas Pakulat wrote:
> just found that KPart::PartManager::addPart happily crashes when handed
> a 0-pointer. While one could argue that this shouldn't happen in the
> first place its also not nice to just crash in this case. The patch
> below adds a check and a kfatal output.
>
> If nobody objects I'll commit that on tuesday.

Sorry, I don't read k-c-d even day. Waiting a little longer next time would be 
appreciated. Especially when its a holiday ;)

I think the added code is not very useful, and it slows down production code.
Please replace the if construct with a single
 Q_ASSERT(part);
which will tell you exactly which line you went wrong (since calling this 
method with a null pointer _is_ a bug), without the overhead.

Can you fix?  Thanks.
-- 
Thomas Zander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070220/dd72ada7/attachment.sig>


More information about the kde-core-devel mailing list