[vlc-devel] [PATCH 2/2] module: don't probe next modules if killed

Thomas Guillem thomas at gllm.fr
Thu Oct 24 09:17:27 CEST 2019


This fixes the following case (it's just an example, it may fix some others).

 - a samba module is first probed, it asks for user credentials and show a
   dialog. The user cancel the media parsing instead of canceling the dialog
   (hit Ctrl-C on Desktop when a dialog is shown)

 - A next samba module is probed and will also ask for credential. A dialog
   will be shown even though the user asked to terminate VLC.

To fix this issue, this commit prevent the next module to load if the current
thread loading the module is killed.

There is no possible race here, even if the thread is killed just after the
second module is loaded. In that case next dialog, poll and read call will be
interrupted and no dialog will be shown.
---
 src/modules/modules.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index 2df5702f840..c3a4228aa22 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -37,6 +37,7 @@
 
 #include <vlc_common.h>
 #include <vlc_modules.h>
+#include <vlc_interrupt.h>
 #include "libvlc.h"
 #include "config/configuration.h"
 #include "vlc_arrays.h"
@@ -199,6 +200,9 @@ module_t *(vlc_module_load)(struct vlc_logger *log, const char *capability,
                     /* fall through */
                 case VLC_ETIMEOUT:
                     goto done;
+                default:
+                    if (vlc_killed())
+                        goto done;
             }
         }
     }
@@ -220,6 +224,9 @@ module_t *(vlc_module_load)(struct vlc_logger *log, const char *capability,
                     /* fall through */
                 case VLC_ETIMEOUT:
                     goto done;
+                default:
+                    if (vlc_killed())
+                        goto done;
             }
         }
     }
-- 
2.20.1



More information about the vlc-devel mailing list