D26764: Another revert to unbreak crash fix

Konstantin Kharlamov noreply at phabricator.kde.org
Fri Jan 24 23:30:00 GMT 2020


kkharlamov added a comment.


  In D26764#600319 <https://phabricator.kde.org/D26764#600319>, @anthonyfieroni wrote:
  
  >   atexit([&app]() {
  >       app.reset();
  >   });
  >
  >
  > Could be better approach, then remove deleteQApplication and needToDeleteQApplication.
  
  
  Thanks! Note that unfortunately in C++ lambda-closures can not be converted to a raw function pointer, and `atexit` is an old C-like function that can't accept lambdas.
  
  However, looking at docs for `atexit`, it seems the best way to work around that situation is to make `app` inside the main function a static variable. Per docs, on `exit` call destructors for static objects are called. I gotta experiment with it though, and to look through the code to make sure everything is okay. Hopefully, I'll craft up an MR in under an hour, and will put a link to it here in comments.

REPOSITORY
  R319 Konsole

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

To: sandsmark, #konsole, hindenburg, kkharlamov
Cc: anthonyfieroni, konsole-devel, hindenburg, #konsole, hiangel, cent, EspadaV8, fbampaloukas, thsurrel, ngraham, maximilianocuria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20200124/b5b85035/attachment.html>


More information about the konsole-devel mailing list