D15295: [konsole]: proper fix for a crash-on-exit

René J.V. Bertin noreply at phabricator.kde.org
Thu Oct 18 10:05:57 BST 2018


rjvbb added a comment.


  Sorry for the delay; I thought this would be straightforward and then ran into questions...

INLINE COMMENTS

> sandsmark wrote in ViewSplitter.cpp:46
> why a foreach instead of a normal for (foo : bar) {}?
> 
> and I'm a bit allergic to auto, I don't know what container is without opening viewsplitter.h. but that's a personal preference.

I simply haven't adapted yet to the fact that there's now a "normal for" equivalent of Qt's equally "normal foreach"...

If you prefer I can use an explicit type but I think this is as good a place to be lazy as any. Besides, in any self-respecting IDE you can hover the mouse cursor over either the variable or `unregisterContainer()` and a popup will tell you what type the variable (must) be ;)

> sandsmark wrote in ViewSplitter.h:185
> change this to a QPointer while you're at it, and maybe add some null checks, so we can avoid similar issues in the future.

I'm not certain I get this. Put `_containers` in a QPointer or make it a `QList< QPointer<TabbedViewContainer *> >`?

The former is impossible AFAIK (QList doesn't inherit QObject), while the latter isn't relevant because the crash was caused by accessing a stale `_containers` instance (i.e. a member variable of a stale `ViewSplitter` instance).

REPOSITORY
  R319 Konsole

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

To: rjvbb, #konsole, hindenburg
Cc: sandsmark, anthonyfieroni, tcanabrava, konsole-devel, #kde_applications, ngraham, maximilianocuria, hindenburg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20181018/b18d7aa9/attachment-0001.html>


More information about the konsole-devel mailing list