Review Request 128874: Free QFileDialog memory

Łukasz Wojniłowicz lukasz.wojnilowicz at gmail.com
Sat Sep 10 07:59:34 UTC 2016



> On Wrz 10, 2016, 8:03 rano, Thomas Baumgart wrote:
> > kmymoney/plugins/csvimport/csvwizard.cpp, line 769
> > <https://git.reviewboard.kde.org/r/128874/diff/1/?file=476633#file476633line769>
> >
> >     Don't use dialog past this point w/o checking it for being unequal to 0. This is a very well known problem in Qt applications. exec() can delete the dialog in the background before it returns. See https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0 for more details. Not sure, if this is related to your problem.

That wasn't the problem, but I changed the code to take that into account. The problem with above line was filter
i18n("*.csv *.PRN *.txt | CSV Files\n *|All files").
It's wrong and should be
"CSV Files (*.csv)".
Changing that helps.

Now I get "The program has unexpectedly finished" when follwing line is uncommented
```c++
dialog->setOption(QFileDialog::DontUseNativeDialog, true);  //otherwise we cannot add custom QComboBox
```
Thomas do you know any tricks here?


- Łukasz


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


On Wrz 9, 2016, 6:10 po południu, Łukasz Wojniłowicz wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128874/
> -----------------------------------------------------------
> 
> (Updated Wrz 9, 2016, 6:10 po południu)
> 
> 
> Review request for KMymoney.
> 
> 
> Repository: kmymoney
> 
> 
> Description
> -------
> 
> After closing CSV Importer in the middle and then KMyMoney, I get "The program has unexpectedly finished".
> The problem doesn't occur if CSV Importer goes all way through to the last page; then I can go back and close it wherever I want.
> If I comment out this line, there is no problem at all.
> ```c++
>   QPointer<QFileDialog> dialog = new QFileDialog(this, QString(),
>                                                  fileInfo.absoluteFilePath(),
>                                                  i18n("*.csv *.PRN *.txt | CSV Files\n *|All files"));
> ```
> Memory on which dialog pointed wasn't deleted in the method and it obviously need to be deleted, but the problem remains. Does anyone know how to prevent QtCreator from showing "The program has unexpectedly finished" here?
> 
> 
> Diffs
> -----
> 
>   kmymoney/plugins/csvimport/csvwizard.h ecec5b0 
>   kmymoney/plugins/csvimport/csvwizard.cpp b576dea 
> 
> Diff: https://git.reviewboard.kde.org/r/128874/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Łukasz Wojniłowicz
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20160910/fd42ffcf/attachment-0001.html>


More information about the KMyMoney-devel mailing list