WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
224480
Remove the comment in ~AudioSourceProviderAVFObjC about undefined behavior
https://bugs.webkit.org/show_bug.cgi?id=224480
Summary
Remove the comment in ~AudioSourceProviderAVFObjC about undefined behavior
Kimmo Kinnunen
Reported
2021-04-13 05:12:45 PDT
AudioSourceProviderAVFObjC locks a mutex in destructor. This is undefined behavior, since the mutex controls access to the object members. Since the object cannot have multiple active references during destruction, mutex locking should not be needed. However, it is needed, and as such this indicates undefined behavior.´
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2021-04-13 15:01:25 PDT
> This is undefined behavior, since the mutex controls access to the object members.
Object members are destroyed after the destructor runs, so I don't see a problem with this code.
Kimmo Kinnunen
Comment 2
2021-04-14 12:03:49 PDT
> > This is undefined behavior, since the mutex controls access to the object members. > > Object members are destroyed after the destructor runs, so I don't see a > problem with this code.
Yeah, you're right. I took a bit of a mental shortcut, thinking about the case where the mutex would be moved to the class for more logical operation. I'll use this bug to remove the comment.
Kimmo Kinnunen
Comment 3
2021-04-14 12:08:11 PDT
Ah, no, maybe not. I think the issue still stands.
> Object members are destroyed after the destructor runs, so I don't see a problem with this code.
It's not about destroying the members. The bug is about what C++ defines as being "well-formed program". I think I recall, and it sort of makes sense, that a well-formed program cannot have the execution in destructor and a member function at the same time. In practice it works, as the data members are destroyed after end of the destructor. However, typically one should not rely on "in practice it works" if it's contrary to the soundness definition of the language.
Kimmo Kinnunen
Comment 4
2021-04-14 12:28:51 PDT
Clarified it: I was remembering and thinking wrong. So I'll remove the comment in the destructor.
Radar WebKit Bug Importer
Comment 5
2021-04-20 05:13:15 PDT
<
rdar://problem/76894075
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug