I looked at mythcontext.cpp

At first glance I noticed a small memory issue that probably doesn't
have much to do with this issue, just thought I'd mention it.   This
is in function:  MythContext::CacheThemeImagesDirectory

       if (!cacheinfo.exists() ||
            (cacheinfo.lastModified() < fi->lastModified()))
        {
            VERBOSE(VB_FILE, QString("generating cache image for: %1")
                    .arg(fi->absFilePath()));

            QImage *tmpimage = LoadScaleImage(fi->absFilePath(), false);

            if (tmpimage && tmpimage->width() > 0 && tmpimage->height() > 0)
            {
                if (!tmpimage->save(destdir + filename, "PNG"))
                {
                    cerr << "Couldn't save cache cache image: "
                         << d->themecachedir + filename << endl;
                }
            
---->  take delete this out of if block
                delete tmpimage;
            }
         }

This code block should have the 'delete tmpimage' outside of the if
statement.   It's ok to delete null values and it's ok to delete
allocated values.  The current implementation leaks memory if an image
has either width or height == 0.

Maybe someone can fix this issue without me having to submit a diff? 
If not, I can submit a patch.

Alan

On Wed, 8 Dec 2004 13:46:09 -0800 (PST), Chris Tracy <[EMAIL PROTECTED]> wrote:
> 
>         Having fumbled my way through debugging the issue, I added some
> code in libs/libmyth/themedmenu.cpp to ThemedMenuPrivate::parseSettings().
> In the main while loop (around line 1255) I added a system() call to print
> out the memory usage of mythfrontend during each iteration through the
> loop.  What I found is that calls to ThemedMenuPrivate::parseButton()
> seemed to be the culprit.  Looking deeper, calls from parseButton() to
> MythContext::LoadScaleImage() were to blame, but only when loading
> watermark images and then only in certain cases.
_______________________________________________
mythtv-dev mailing list
[EMAIL PROTECTED]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to