Review Request 128016: [OS X] Prevent a crash in the IdealDockWidget's context menu

Sven Brauch mail at svenbrauch.de
Thu May 26 09:46:32 UTC 2016



> On May 26, 2016, 8:56 a.m., Sven Brauch wrote:
> > sublime/idealdockwidget.cpp, line 119
> > <https://git.reviewboard.kde.org/r/128016/diff/1/?file=465464#file465464line119>
> >
> >     ... and, by the way, this should have the menu as parent, right? using this will leak it
> 
> René J.V. Bertin wrote:
>     That's independent of my patch, no?

Yes :) but while you're touching it ...


> On May 26, 2016, 8:56 a.m., Sven Brauch wrote:
> > sublime/idealdockwidget.cpp, line 99
> > <https://git.reviewboard.kde.org/r/128016/diff/1/?file=465464#file465464line99>
> >
> >     Don't do this. It just clutters the code, and you would have to fix it in about every second line of the application anyways, should it ever happen (it doesn't on linux).
> 
> René J.V. Bertin wrote:
>     I don't understand what you're implying here. Not doing this would either mean not using a pointer at all (= abandoning the patch), or not checking if the allocation succeeded. And that's not acceptable either. No matter how likely an application is to crash anyway if an allocation fails.
>     From what I see this is true also when using a QScopedPointer.

Nowhere in KDE code does anybody ever check if an allocation succeeds. IMO it's pedantic and useless. We are not writing life-critical software; if your system is out of memory, your IDE crashes, such is life. On Linux it doesn't do anything _anyways_ in the default kernel configuration, since allocations always succeed.


- Sven


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128016/#review95813
-----------------------------------------------------------


On May 25, 2016, 8:54 p.m., René J.V. Bertin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128016/
> -----------------------------------------------------------
> 
> (Updated May 25, 2016, 8:54 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdevplatform
> 
> 
> Description
> -------
> 
> OS X can be capricious when instances corresponding to a widget are deleted, if the class in question uses "native" ObjC SDKs behind the scenes. Pending events can in that case be (generated and) delivered to objects that were already deleted.
> According to the documentation, one should prefer to use `QObject::deleteLater()` rather than the regular, direct `delete` whether it be explicit or implicit.
> 
> I've long used a local patch that uses this approach in order to prevent a recurring crash after using the context menu of the "ideal dock widget". Somehow I never put it up for review here, apparently.
> 
> 
> Diffs
> -----
> 
>   sublime/idealdockwidget.cpp dae0ea2 
> 
> Diff: https://git.reviewboard.kde.org/r/128016/diff/
> 
> 
> Testing
> -------
> 
> Builds and permits reliable behaviour on both OS X and Linux.
> 
> 
> Thanks,
> 
> René J.V. Bertin
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160526/f89e0f57/attachment-0001.html>


More information about the KDevelop-devel mailing list