https://bugs.kde.org/show_bug.cgi?id=378909

            Bug ID: 378909
           Summary: KDevelop leaving temp files behind on Mac
           Product: kdevplatform
           Version: unspecified
          Platform: Compiled Sources
                OS: OS X
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: vcs
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: rjvber...@gmail.com
  Target Milestone: ---

KDevelop on Mac leaves lots of `kdevelop*` and `preamble*` files behind in the
user's temp. directory (`$TMPDIR`). That's probably something platform-specific
in Qt but I've decided to look in to it.

For instance, patch files aren't removed when quitting a session, at least not
all of them. Looking at the code I notice a subtle difference in the open/close
management:

```
void VCSDiffPatchSource::updateFromDiff(VcsDiff vcsdiff)
{
    if(!m_file.isValid())
    {
        QTemporaryFile temp2(QDir::tempPath() +
QLatin1String("/kdevelop_XXXXXX.patch"));
        temp2.setAutoRemove(false);
        temp2.open();
        QTextStream t2(&temp2);
        t2 << vcsdiff.diff();
        qCDebug(VCS) << "filename:" << temp2.fileName();
        m_file = QUrl::fromLocalFile(temp2.fileName());
        temp2.close();
    }else{
        QFile file(m_file.path());
        file.open(QIODevice::WriteOnly);
        QTextStream t2(&file);
        t2 << vcsdiff.diff();
    }
```

When creating a new diff the QTemporaryFile instance is opened and closed
explicitly while the QFile instance used to update the file contents is opened
but never closed.

I don't see however how this would change the effect of the explicit
`QFile::remove(m_file...)` in the `VCSDiffPatchSource` dtor?!
(BTW, shouldn't that remove instruction be conditional on m_file.isValid()?)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to