Bug 261886 - Once KMM opened, by force of habit, I opened CSV import. When the plugin opened, I closed it immediately and KMM crashed.
Summary: Once KMM opened, by force of habit, I opened CSV import. When the plugin op...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: SVN
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-02 18:43 UTC by allan
Modified: 2011-05-06 17:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description allan 2011-01-02 18:43:44 UTC
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.
Comment 1 Fernando Vilas 2011-01-02 19:12:09 UTC
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.
Comment 2 allan 2011-01-02 19:43:10 UTC
(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.
Comment 3 Thomas Baumgart 2011-01-08 09:12:38 UTC
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.
Comment 4 Cristian Oneț 2011-05-06 17:04:00 UTC
This is fix as far as I remember.
Comment 5 allan 2011-05-06 17:50:56 UTC
(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.