| Summary: | Once KMM opened, by force of habit, I opened CSV import. When the plugin opened, I closed it immediately and KMM crashed. | ||
|---|---|---|---|
| Product: | [Applications] kmymoney | Reporter: | allan <agander93> |
| Component: | general | Assignee: | KMyMoney Devel Mailing List <kmymoney-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | ||
| Priority: | NOR | ||
| Version First Reported In: | SVN | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
In C++, it is always safe to delete a null pointer. The crash would be caused by something else, like trying to delete memory that had already been deleted. (In reply to comment #1) > In C++, it is always safe to delete a null pointer. The crash would be caused > by something else, like trying to delete memory that had already been deleted. Ah, thanks, Fernando. I was just about to look more closely at what was going on. It did seem a bit odd to need to do that. Looks like you get caught by the Qt object hierarchy which takes care of deleting objects. If you setup a correct parent/children relationship you should not have to worry about the destruction of the widgets. This is fix as far as I remember. (In reply to comment #4) > This is fix as far as I remember. I think so, too, but should have specifically documented it. The code is now much changed. |
Version: SVN trunk (using KDE 4.5.85) OS: Linux Once KMM opened, by force of habit, I opened CSV import. Realising it wasn't needed for what I was intending to do, once the plugin opened, I closed it immediately, and KMM crashed. The crash occurred here:- RedefineDlg::~RedefineDlg() { delete m_widget; }. My first thought was to test for m_widget being NULL before the delete. On repeating the process, the identical crash occurred. RedefineDlg() is called in the ctor of InvestmentDlg() - m_redefine = new RedefineDlg, and destroyed in its dtor. So I repeated the NULL test here. This time, there was no crash. I then thought it could be a timing issue, as I had closed the plugin pretty quickly, so removed the NULL tests, and waited a few seconds before closing the plugin, and there was no crash. However, I have since been unable to reproduce the crash, so am a bit puzzled. I had a crash yesterday, which I accidentally failed to obtain the evidence, but am pretty sure the circumstances were the same. I'm leaving the NULL tests out for the time being. Reproducible: Sometimes Steps to Reproduce: Open KMM, open the CSV Plugin, then immediately close it. Actual Results: A crash occurs. Expected Results: No crash occurs.