This works around (what appears to be) a thread-safety issue in
libwapcaplet:
https://bugs.netsurf-browser.org/mantis/view.php?id=2857
g_assert((int)width >= 0);
g_assert((int)height >= 0);
+
+ /* There's a thread-safety issue in libwapcaplet that can cause
+ * svgtiny_parse() to crash if you load lots of SVGs at once:
+ *
+ * https://bugs.netsurf-browser.org/mantis/view.php?id=2857
+ *
+ * Putting a lock around svgtiny_parse() is a pretty simple solution
+ * and looks like it does the trick.
+ */
+ static GMutex mutex;
+ g_mutex_lock(&mutex);
code = svgtiny_parse(diagram,
- buffer,
- bytecount, "",
- (int)width,
- (int)height);
+ buffer,
+ bytecount, "",
+ (int)width,
+ (int)height);
+ g_mutex_unlock (&mutex);
switch(code) {
case svgtiny_OK: