diff options
author | Aleric Inglewood | 2010-11-10 15:19:13 +0100 |
---|---|---|
committer | Aleric Inglewood | 2010-11-17 01:03:18 +0100 |
commit | b66950bc26cfb3210e786c966141b20a5cc13a84 (patch) | |
tree | 5afd535bfd59f1fb1fc6d9132958965c527aa0ee /linden/indra/media_plugins | |
parent | IMP-712: Add shortcut for the Groups tab. (diff) | |
download | meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.zip meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.tar.gz meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.tar.bz2 meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.tar.xz |
IMP-590: Added a thread-safe and robust wrapper for APR pools.
See http://redmine.imprudenceviewer.org/issues/590
Diffstat (limited to 'linden/indra/media_plugins')
-rw-r--r-- | linden/indra/media_plugins/webkit/linux_volume_catcher.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp b/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp index c4c4181..cc3836e 100644 --- a/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp +++ b/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp | |||
@@ -58,7 +58,7 @@ extern "C" { | |||
58 | #include <pulse/subscribe.h> | 58 | #include <pulse/subscribe.h> |
59 | #include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken. | 59 | #include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken. |
60 | 60 | ||
61 | #include "apr_pools.h" | 61 | #include "aiaprpool.h" |
62 | #include "apr_dso.h" | 62 | #include "apr_dso.h" |
63 | } | 63 | } |
64 | 64 | ||
@@ -74,7 +74,7 @@ extern "C" { | |||
74 | #undef LL_PA_SYM | 74 | #undef LL_PA_SYM |
75 | 75 | ||
76 | static bool sSymsGrabbed = false; | 76 | static bool sSymsGrabbed = false; |
77 | static apr_pool_t *sSymPADSOMemoryPool = NULL; | 77 | static AIAPRPool sSymPADSOMemoryPool; |
78 | static apr_dso_handle_t *sSymPADSOHandleG = NULL; | 78 | static apr_dso_handle_t *sSymPADSOHandleG = NULL; |
79 | 79 | ||
80 | bool grab_pa_syms(std::string pulse_dso_name) | 80 | bool grab_pa_syms(std::string pulse_dso_name) |
@@ -93,11 +93,11 @@ bool grab_pa_syms(std::string pulse_dso_name) | |||
93 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0) | 93 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0) |
94 | 94 | ||
95 | //attempt to load the shared library | 95 | //attempt to load the shared library |
96 | apr_pool_create(&sSymPADSOMemoryPool, NULL); | 96 | sSymPADSOMemoryPool.create(); |
97 | 97 | ||
98 | if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle, | 98 | if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle, |
99 | pulse_dso_name.c_str(), | 99 | pulse_dso_name.c_str(), |
100 | sSymPADSOMemoryPool) )) | 100 | sSymPADSOMemoryPool()) )) |
101 | { | 101 | { |
102 | INFOMSG("Found DSO: %s", pulse_dso_name.c_str()); | 102 | INFOMSG("Found DSO: %s", pulse_dso_name.c_str()); |
103 | 103 | ||
@@ -140,11 +140,7 @@ void ungrab_pa_syms() | |||
140 | sSymPADSOHandleG = NULL; | 140 | sSymPADSOHandleG = NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | if ( sSymPADSOMemoryPool ) | 143 | sSymPADSOMemoryPool.destroy(); |
144 | { | ||
145 | apr_pool_destroy(sSymPADSOMemoryPool); | ||
146 | sSymPADSOMemoryPool = NULL; | ||
147 | } | ||
148 | 144 | ||
149 | // NULL-out all of the symbols we'd grabbed | 145 | // NULL-out all of the symbols we'd grabbed |
150 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0) | 146 | #define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0) |