Opened 18 years ago

Closed 18 years ago

#1910 closed defect (fixed)

MythMainWindow::RegisterMediaHandler crashes if no MediaMontior configured

Reported by: Robert Tsai Owned by: danielk
Priority: minor Milestone: 0.20
Component: mythtv Version: head
Severity: medium Keywords:
Cc: danielk Ticket locked: no

Description

RegisterMediaHandler? has:

        MediaMonitor *mon = MediaMonitor::GetMediaMonitor();
        if (!extensions.isEmpty())
            mon->MonitorRegisterExtensions(mediaType, extensions);

However, "mon" is empty for me:

MediaMonitor* MediaMonitor::GetMediaMonitor(void)
{
    if (c_monitor)
        return c_monitor;

    if (gContext->GetNumSetting("MonitorDrives"))
    {
        c_monitor = new MediaMonitor(NULL, 500, true);
        c_monitor->CheckFileSystemTable();
        c_monitor->CheckMountable();
    }

    return c_monitor;
}

so my frontend crashes.

Change History (5)

comment:1 Changed 18 years ago by Robert Tsai

Cc: danielk added

introduced by [10095]. I don't know if this is a "&& mon != NULL" kind of thing, or if GetMediaMonitor? is never supposed to return NULL.

comment:2 Changed 18 years ago by danielk

Milestone: 0.20
Owner: changed from Isaac Richards to danielk

I'll look at this tomorrow.

What platform is this on? Linux, OSX, other?

comment:3 Changed 18 years ago by mythdev@…

fyi this fails on 32bit linux 2.6.16.5 and 2.6.14 - stepping upto the fail point it is in the QValueList header - line 563 of qvaluelist.h @ QT 3.3.3 - when this == 0x0

    void detach() { if ( sh->count > 1 ) detachInternal(); }

this being invoked from the last line below

void MediaMonitor::MonitorRegisterExtensions(uint mediatype,
                                             const QString &extensions)
{
    VERBOSE(VB_IMPORTANT, QString("MonitorRegisterExtensions(0x%1, %2)")
            .arg(mediatype, 0, 16).arg(extensions));

    QValueList<MythMediaDevice*>::iterator it = m_Devices.begin();

Still exists with distclean builds of myth & plugins

comment:4 Changed 18 years ago by mj@…

I'm experiencing the same problem. Segfault of frontend startup since 10095 after registering extentions. I'm on 64bit linux 2.6.15-r7.

comment:5 Changed 18 years ago by danielk

Resolution: fixed
Status: newclosed

(In [10103]) Fixes #1910. Adds null pointer check on return from GetMediaMonitor?() before using the pointer.

Note: See TracTickets for help on using tickets.