<html><head></head><body>Hi,<br><br>I am on holidays without laptop, so I cannot check, but I believe the answer to your question is history. I mean, vlc_assert_unreachable() should be used there but it probably did not exist when the code was written.<br><br><div class="gmail_quote">Le 20 septembre 2019 15:49:50 GMT+03:00, Romain Vimont <rom1v@videolabs.io> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">On Fri, Sep 20, 2019 at 03:13:08PM +0300, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">I completely disagree. When event registration/deregistration fails, you're almost guaranteed a deadlock or some use after free. Much better to abort asap.<br></blockquote><br>If an assertion fails, then the program has (probably) undefined<br>behavior.<br><br>But why using assert() everywhere but abort() here? There are a lot of<br>places where a failing assert() would almost guarantee a deadlock or<br>some use after free.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le 20 septembre 2019 12:21:37 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">Because you should not abort in production. Developers will still be<br>notified<br>that they are miss-using the API with the assert.<br><br>PS: this abort was happening on iOS via VLCKit, the API miss-use had<br>been fixed<br>here: <a href="https://code.videolan.org/videolan/VLCKit/merge_requests/19">https://code.videolan.org/videolan/VLCKit/merge_requests/19</a><hr> lib/event.c | 2 +-<br> 1 file changed, 1 insertion(+), 1 deletion(-)<br><br>diff --git a/lib/event.c b/lib/event.c<br>index 28d3d0c232..4a57029b89 100644<br>--- a/lib/event.c<br>+++ b/lib/event.c<br>@@ -179,5 +179,5 @@ void libvlc_event_detach(libvlc_event_manager_t<br>*em, libvlc_event_type_t type,<br>              return;<br>          }<br>     }<br>-    abort();<br>+    assert(!"event not found or already detached");<br> }<br>-- <br>2.20.1<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.<br></blockquote><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>