summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/media_plugins/webkit/linux_volume_catcher.cpp5
-rw-r--r--indra/media_plugins/webkit/media_plugin_webkit.cpp17
2 files changed, 18 insertions, 4 deletions
diff --git a/indra/media_plugins/webkit/linux_volume_catcher.cpp b/indra/media_plugins/webkit/linux_volume_catcher.cpp
index 2e7fda865e..5eaef0e1c3 100644
--- a/indra/media_plugins/webkit/linux_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/linux_volume_catcher.cpp
@@ -47,6 +47,7 @@
extern "C" {
#include <glib.h>
+#include <glib-object.h>
#include <pulse/introspect.h>
#include <pulse/context.h>
@@ -220,6 +221,10 @@ void VolumeCatcherImpl::init()
mGotSyms = loadsyms("libpulse-mainloop-glib.so.0");
if (!mGotSyms) return;
+ // better make double-sure glib itself is initialized properly.
+ if (!g_thread_supported ()) g_thread_init (NULL);
+ g_type_init();
+
mMainloop = llpa_glib_mainloop_new(g_main_context_default());
if (mMainloop)
{
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index a9ff7bf752..3b00edec4e 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -48,6 +48,7 @@
# define LL_QTWEBKIT_USES_PIXMAPS 0
extern "C" {
# include <glib.h>
+# include <glib-object.h>
}
#else
# define LL_QTWEBKIT_USES_PIXMAPS 0
@@ -132,14 +133,14 @@ private:
//
void update(int milliseconds)
{
-#if LL_LINUX
+#if LL_QTLINUX_DOESNT_HAVE_GLIB
// pump glib generously, as Linux browser plugins are on the
// glib main loop, even if the browser itself isn't - ugh
- //*TODO: shouldn't this be transparent if Qt was compiled with
- // glib mainloop integration? investigate.
+ // This is NOT NEEDED if Qt itself was built with glib
+ // mainloop integration.
GMainContext *mainc = g_main_context_default();
while(g_main_context_iteration(mainc, FALSE));
-#endif // LL_LINUX
+#endif // LL_QTLINUX_DOESNT_HAVE_GLIB
// pump qt
LLQtWebKit::getInstance()->pump( milliseconds );
@@ -213,6 +214,14 @@ private:
}
std::string application_dir = std::string( cwd );
+#if LL_LINUX
+ // take care to initialize glib properly, because some
+ // versions of Qt don't, and we indirectly need it for (some
+ // versions of) Flash to not crash the browser.
+ if (!g_thread_supported ()) g_thread_init (NULL);
+ g_type_init();
+#endif
+
#if LL_DARWIN
// When running under the Xcode debugger, there's a setting called "Break on Debugger()/DebugStr()" which defaults to being turned on.
// This causes the environment variable USERBREAK to be set to 1, which causes these legacy calls to break into the debugger.