Opened 10 years ago

Closed 10 years ago

#5059 closed Bug (fixed)

Memory leak in the TrMainWindow :: openTorrent

Reported by: martonmiklos Owned by: jordan
Priority: Normal Milestone: 2.72
Component: Qt Client Version: 2.71
Severity: Normal Keywords:
Cc:

Description

Problem: The QFileDialog * myFileDialog allocated on the heap, but in never gets deallocated.

Solution: Set the Qt::WA_DeleteOnClose attribute on the myFileDialog

Attachments (3)

openTorrentMemLeak.patch (616 bytes) - added by martonmiklos 10 years ago.
5059-rev-02.patch (2.7 KB) - added by jordan 10 years ago.
fixes for make-dialog.cc, mainwin.cc, options.cc
5059-rev-03.patch (3.0 KB) - added by jordan 10 years ago.

Download all attachments as: .zip

Change History (14)

Changed 10 years ago by martonmiklos

comment:1 Changed 10 years ago by rb07

There are an additional 5 similar uses (in make-dialog.cc, options.cc) that need the same treatment.

An alternative is to use the native open panel, which is a class method.

comment:2 Changed 10 years ago by martonmiklos

You are right after checking the mentioned places it there are several instances of the same problem.

The QFileDialog::getOpenFileName(s) method would not be good because in the openTorrent method we are adding a checkbox to the filedialog. (Anyway in KDE4 this checkbox is not visible. )

Changed 10 years ago by jordan

fixes for make-dialog.cc, mainwin.cc, options.cc

comment:3 Changed 10 years ago by jordan

rb07, markon, does 5059-rev-02.patch look correct to you?

comment:4 Changed 10 years ago by jordan

  • Milestone changed from None Set to 2.72
  • Status changed from new to assigned

comment:5 Changed 10 years ago by rb07

jordan,

No, the patch I used is a little different, and the reasons:

  • Solving issue #5058 (I know, not related to this one) mainwin.cc :
        myFileDialog->setAttribute( Qt::WA_DeleteOnClose );
        myFileDialog->setAttribute( Qt::WA_QuitOnClose, false );
  • In make-dialog.cc (twice), and in options.cc (once), the line before is using a deprecated (on Qt 4.8.x) option (again unrelated to the present issue), not a big deal but... Instead I use:
        d->setFileMode( QFileDialog::Directory );
        d->setOption( QFileDialog::ShowDirsOnly );
Last edited 10 years ago by rb07 (previous) (diff)

comment:6 Changed 10 years ago by martonmiklos

Looks good for me, including the #5058 resolution.

comment:7 Changed 10 years ago by jordan

rb07, do you want to attach a .patch with your fix for 5058 and 5059?

comment:8 Changed 10 years ago by rb07

jordan, It is untested, and what I wrote first was wrong, after my change I think it should work, but I still haven't tested it.

Changed 10 years ago by jordan

comment:9 Changed 10 years ago by jordan

5059-rev-03.patch is the same as rev-02 but removes the deprecated use of QFileDialog::DirectoryOnly? as suggested by rb07.

It does not disable Qt::WA_QuitOnClose for #5058 here, I've commented on that in its own ticket.

If rev-03 looks good to both of you two, I'll commit

comment:10 Changed 10 years ago by rb07

Yes, its fine.

comment:11 Changed 10 years ago by jordan

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r13555.

Note: See TracTickets for help on using tickets.