From f180ef79b2af7c9ad778d270c7f22c83ce0611df Mon Sep 17 00:00:00 2001 From: beveloper Date: Tue, 3 Jun 2003 00:06:49 +0000 Subject: [PATCH] Fixed crash in Cortex caused by BMediaRoster::MakeTimeSourceFor() returning NULL when asked for the system time source. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3400 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/media/MediaRoster.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/kits/media/MediaRoster.cpp b/src/kits/media/MediaRoster.cpp index 16c6d89cba..fee031517e 100644 --- a/src/kits/media/MediaRoster.cpp +++ b/src/kits/media/MediaRoster.cpp @@ -562,16 +562,23 @@ BMediaRoster::ReleaseNode(const media_node & node) BTimeSource * BMediaRoster::MakeTimeSourceFor(const media_node & for_node) { + // MakeTimeSourceFor() returns a BTimeSource object + // corresponding to the specified node's time source. + CALLED(); + + if ((for_node.node == NODE_SYSTEM_TIMESOURCE_ID) && (for_node.kind & B_TIME_SOURCE)) { + // special handling for the system time source + TRACE("BMediaRoster::MakeTimeSourceFor, asked for system time source\n"); + return MediaRosterEx(this)->MakeTimeSourceObject(NODE_SYSTEM_TIMESOURCE_ID); + } + if (IS_INVALID_NODE(for_node)) { - FATAL("BMediaRoster::MakeTimeSourceFor: for_node invalid\n"); + FATAL("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %ld, port %ld, kinds 0x%lx\n", for_node.node, for_node.port, for_node.kind); return NULL; } - printf("BMediaRoster::MakeTimeSourceFor: node %ld enter\n", for_node.node); - - // MakeTimeSourceFor() returns a BTimeSource object - // corresponding to the specified node's time source. + TRACE("BMediaRoster::MakeTimeSourceFor: node %ld enter\n", for_node.node); node_get_timesource_request request; node_get_timesource_reply reply; @@ -586,7 +593,7 @@ BMediaRoster::MakeTimeSourceFor(const media_node & for_node) source = MediaRosterEx(this)->MakeTimeSourceObject(reply.timesource_id); - printf("BMediaRoster::MakeTimeSourceFor: node %ld leave\n", for_node.node); + TRACE("BMediaRoster::MakeTimeSourceFor: node %ld leave\n", for_node.node); return source; }