<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div><br></div><div>On Fri, Sep 27, 2019, at 16:26, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt"><div>Hi,<br></div><div><br></div><div>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></div></blockquote><div><br></div><div>I don't like vlc_assert_unreachable(). I would prefer that this helper abort() instead or doing a __builtin_unreachable().<br>Indeed,it is very hard to debug a code that reached this statement, everything is UB after that. I prefer to kill the process instead of making the app totally UB.<br></div><div><br></div><blockquote type="cite" id="qt"><div><br></div><div class="qt-gmail_quote"><div>Le 20 septembre 2019 15:49:50 GMT+03:00, Romain Vimont <rom1v@videolabs.io> a écrit :<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><pre class="qt-k9mail"><div>On Fri, Sep 20, 2019 at 03:13:08PM +0300, Rémi Denis-Courmont wrote:<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:1ex;margin-left:0.8ex;border-left-color:rgb(114, 159, 207);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote">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><div><br></div><div>If an assertion fails, then the program has (probably) undefined<br></div><div>behavior.<br></div><div><br></div><div>But why using assert() everywhere but abort() here? There are a lot of<br></div><div>places where a failing assert() would almost guarantee a deadlock or<br></div><div>some use after free.<br></div><div><br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:1ex;margin-left:0.8ex;border-left-color:rgb(114, 159, 207);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div>Le 20 septembre 2019 12:21:37 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:1ex;margin-left:0.8ex;border-left-color:rgb(173, 127, 168);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div>Because you should not abort in production. Developers will still be<br></div><div>notified<br></div><div>that they are miss-using the API with the assert.<br></div><div><br></div><div>PS: this abort was happening on iOS via VLCKit, the API miss-use had<br></div><div>been fixed<br></div><div>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></div><div> 1 file changed, 1 insertion(+), 1 deletion(-)<br></div><div><br></div><div>diff --git a/lib/event.c b/lib/event.c<br></div><div>index 28d3d0c232..4a57029b89 100644<br></div><div>--- a/lib/event.c<br></div><div>+++ b/lib/event.c<br></div><div>@@ -179,5 +179,5 @@ void libvlc_event_detach(libvlc_event_manager_t<br></div><div>*em, libvlc_event_type_t type,<br></div><div> return;<br></div><div> }<br></div><div> }<br></div><div>- abort();<br></div><div>+ assert(!"event not found or already detached");<br></div><div> }<br></div><div>-- <br></div><div>2.20.1<hr>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.<br></div></blockquote><div><br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:1ex;margin-left:0.8ex;border-left-color:rgb(114, 159, 207);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div><hr>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><hr>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>