Bug 123403

Summary: MediaStreamTrackPrivate's m_client uninitialized
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, glenn, hta, jer.noble, pnormand, thiago.lacerda, tommyw
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
fix TrackPrivate eric.carlson: review+

Description Philippe Normand 2013-10-28 07:55:06 PDT
This leads to a segfault, the member variable should be initialized in the constructor I think. Trivial patch incoming.

#0  0x00007fc66cfd50f9 in WebCore::MediaStreamTrackPrivate::setReadyState (this=0x21d1e90, 
    state=WebCore::MediaStreamSource::Live)
    at ../../Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp:191
#1  0x00007fc66cfd4c4e in WebCore::MediaStreamTrackPrivate::setSource (this=0x21d1e90, 
    source=0x2257710) at ../../Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp:80
#2  0x00007fc66cfd4bbd in WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate (
    this=0x21d1e90, source=0x2257710)
    at ../../Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp:69
#3  0x00007fc66cfd49fc in WebCore::MediaStreamTrackPrivate::create (source=...)
    at ../../Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp:39
#4  0x00007fc66cfd1a0b in WebCore::MediaStreamDescriptor::MediaStreamDescriptor (this=0x2125b60, 
    id="2bd7aee2-a71a-4f68-847f-fe8bba59dca2", 
    audioSources=WTF::Vector of length 1, capacity 16 = {...}, 
    videoSources=WTF::Vector of length 1, capacity 16 = {...}, ended=false)
    at ../../Source/WebCore/platform/mediastream/MediaStreamDescriptor.cpp:109
#5  0x00007fc66cfd1645 in WebCore::MediaStreamDescriptor::create (
    audioSources=WTF::Vector of length 1, capacity 16 = {...}, 
    videoSources=WTF::Vector of length 1, capacity 16 = {...}, 
    flag=WebCore::MediaStreamDescriptor::IsNotEnded)
    at ../../Source/WebCore/platform/mediastream/MediaStreamDescriptor.cpp:49
#6  0x00007fc66cfdcbfd in WebCore::MediaStreamCenterGStreamer::createMediaStream (this=0x22d99e0, 
    prpQueryClient=..., audioConstraints=..., videoConstraints=...)
    at ../../Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp:102
#7  0x00007fc66d0c9525 in WebCore::UserMediaRequest::createMediaStream (this=0x21c4500)
    at ../../Source/WebCore/Modules/mediastream/UserMediaRequest.cpp:151
#8  0x00007fc66d0caf97 in WTF::FunctionWrapper<void (WebCore::UserMediaRequest::*)()>::operator()
    (this=0x1f77100, c=0x21c4500) at ../../Source/WTF/wtf/Functional.h:218
#9  0x00007fc66d0cada0 in WTF::BoundFunctionImpl<WTF::FunctionWrapper<void (WebCore::UserMediaRequest::*)()>, void (WebCore::UserMediaRequest*)>::operator()() (this=0x1f770f0)
    at ../../Source/WTF/wtf/Functional.h:496
#10 0x00007fc67140d93f in WTF::Function<void ()>::operator()() const (this=0x21cb5e0)
    at ../../Source/WTF/wtf/Functional.h:704
#11 0x00007fc67140d005 in std::_Function_handler<void (), WTF::Function<void ()> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/4.8/functional:2071
#12 0x00007fc67140c338 in std::function<void ()>::operator()() const (this=0x1f833c0)
    at /usr/include/c++/4.8/functional:2468
#13 0x00007fc67140b910 in WTF::callFunctionObject (context=0x1f833c0)
    at ../../Source/WTF/wtf/MainThread.cpp:236
#14 0x00007fc67140b592 in WTF::dispatchFunctionsFromMainThread ()
    at ../../Source/WTF/wtf/MainThread.cpp:167
#15 0x00007fc67143020d in WTF::timeoutFired () at ../../Source/WTF/wtf/gtk/MainThreadGtk.cpp:43
#16 0x00007fc6693e3c63 in g_timeout_dispatch (source=source@entry=0x1f579e0, 
    callback=<optimized out>, user_data=<optimized out>) at gmain.c:4450
#17 0x00007fc6693e3106 in g_main_dispatch (context=0x1d2e1e0) at gmain.c:3065
#18 g_main_context_dispatch (context=context@entry=0x1d2e1e0) at gmain.c:3641
#19 0x00007fc6693e3458 in g_main_context_iterate (context=0x1d2e1e0, block=block@entry=1, 
    dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3712
#20 0x00007fc6693e385a in g_main_loop_run (loop=0x1dd2e80) at gmain.c:3906
#21 0x00007fc66d5c6f7a in WebCore::RunLoop::run ()
    at ../../Source/WebCore/platform/gtk/RunLoopGtk.cpp:61
#22 0x00007fc66be6209b in WebKit::WebProcessMainGtk (argc=2, argv=0x7fff45a87888)
    at ../../Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:78
#23 0x000000000040095d in main (argc=2, argv=0x7fff45a87888)
    at ../../Source/WebKit2/gtk/MainGtk.cpp:31
(gdb) f 0
#0  0x00007fc66cfd50f9 in WebCore::MediaStreamTrackPrivate::setReadyState (this=0x21d1e90, 
    state=WebCore::MediaStreamSource::Live)
    at ../../Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp:191
191	        m_client->trackReadyStateChanged();
(gdb) p m_client
$1 = (WebCore::MediaStreamTrackPrivateClient *) 0x40
Comment 1 Philippe Normand 2013-10-28 07:58:27 PDT
Created attachment 215308 [details]
fix TrackPrivate
Comment 2 Eric Carlson 2013-10-28 08:07:31 PDT
Comment on attachment 215308 [details]
fix TrackPrivate

I guess I can pull this fix out of my patch for 123316 :-)
Comment 3 Philippe Normand 2013-10-28 08:12:28 PDT
Ah, thank you :)
Comment 4 Thiago de Barros Lacerda 2013-10-28 08:13:56 PDT
(In reply to comment #1)
> Created an attachment (id=215308) [details]
> fix TrackPrivate

Sorry to let that pass :(
Also set the MediaStreamTrackPrivate MediaStreamTrack constructor
Comment 5 Philippe Normand 2013-10-28 08:14:59 PDT
Committed r158109: <http://trac.webkit.org/changeset/158109>
Comment 6 Philippe Normand 2013-10-28 08:16:28 PDT
(In reply to comment #4)
> (In reply to comment #1)
> > Created an attachment (id=215308) [details] [details]
> > fix TrackPrivate
> 
> Sorry to let that pass :(

No problem :)

> Also set the MediaStreamTrackPrivate MediaStreamTrack constructor

Hum? I didn't notice that issue, perhaps we can deal with it in a new bug?
Comment 7 Thiago de Barros Lacerda 2013-10-28 08:21:13 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > (In reply to comment #1)
> > > Created an attachment (id=215308) [details] [details] [details]
> > > fix TrackPrivate
> > 
> > Sorry to let that pass :(
> 
> No problem :)
> 
> > Also set the MediaStreamTrackPrivate MediaStreamTrack constructor
> 
> Hum? I didn't notice that issue, perhaps we can deal with it in a new bug?

I mean set the MediaStreamTrackPrivate's client inside MediaStreamTrack constructor. By looking quickly at the code I could not see it being set. Maybe Eric can put in his bug too
Comment 8 Eric Carlson 2013-10-28 08:23:06 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > (In reply to comment #1)
> > > Created an attachment (id=215308) [details] [details] [details]
> > > fix TrackPrivate
> > 
> > Sorry to let that pass :(
> 
> No problem :)
> 
> > Also set the MediaStreamTrackPrivate MediaStreamTrack constructor
> 
> Hum? I didn't notice that issue, perhaps we can deal with it in a new bug?

(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #4)
> > > (In reply to comment #1)
> > > > Created an attachment (id=215308) [details] [details] [details] [details]
> > > > fix TrackPrivate
> > > 
> > > Sorry to let that pass :(
> > 
> > No problem :)
> > 
> > > Also set the MediaStreamTrackPrivate MediaStreamTrack constructor
> > 
> > Hum? I didn't notice that issue, perhaps we can deal with it in a new bug?
> 
> I mean set the MediaStreamTrackPrivate's client inside MediaStreamTrack constructor. By looking quickly at the code I could not see it being set. Maybe Eric can put in his bug too

Yes, I have done that in bug 123316 as well.