VWR-21275 FIX // *SOME* Windows systems fail to load the Qt plugins if the current working
Reviewed by Richard - http://codereview.lindenlab.com/6011001/master
parent
09b009fc23
commit
7e6ce12a17
|
|
@ -64,9 +64,10 @@ LLPluginClassMedia::~LLPluginClassMedia()
|
|||
reset();
|
||||
}
|
||||
|
||||
bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug)
|
||||
bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug)
|
||||
{
|
||||
LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
|
||||
LL_DEBUGS("Plugin") << "dir: " << plugin_dir << LL_ENDL;
|
||||
LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
|
||||
|
||||
mPlugin = new LLPluginProcessParent(this);
|
||||
|
|
@ -77,7 +78,7 @@ bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::s
|
|||
message.setValue("target", mTarget);
|
||||
sendMessage(message);
|
||||
|
||||
mPlugin->init(launcher_filename, plugin_filename, debug);
|
||||
mPlugin->init(launcher_filename, plugin_dir, plugin_filename, debug);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public:
|
|||
|
||||
// local initialization, called by the media manager when creating a source
|
||||
virtual bool init(const std::string &launcher_filename,
|
||||
const std::string &plugin_dir,
|
||||
const std::string &plugin_filename,
|
||||
bool debug);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
|
||||
#include "llapr.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "direct.h" // needed for _chdir()
|
||||
#endif
|
||||
|
||||
/** Virtual destructor. */
|
||||
LLPluginInstanceMessageListener::~LLPluginInstanceMessageListener()
|
||||
{
|
||||
|
|
@ -73,10 +77,24 @@ LLPluginInstance::~LLPluginInstance()
|
|||
* @param[in] plugin_file Name of plugin dll/dylib/so. TODO:DOC is this correct? see .h
|
||||
* @return 0 if successful, APR error code or error code from the plugin's init function on failure.
|
||||
*/
|
||||
int LLPluginInstance::load(std::string &plugin_file)
|
||||
int LLPluginInstance::load(const std::string& plugin_dir, std::string &plugin_file)
|
||||
{
|
||||
pluginInitFunction init_function = NULL;
|
||||
|
||||
if ( plugin_dir.length() )
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
// VWR-21275:
|
||||
// *SOME* Windows systems fail to load the Qt plugins if the current working
|
||||
// directory is not the same as the directory with the Qt DLLs in.
|
||||
// This should not cause any run time issues since we are changing the cwd for the
|
||||
// plugin shell process and not the viewer.
|
||||
// Changing back to the previous directory is not necessary since the plugin shell
|
||||
// quits once the plugin exits.
|
||||
_chdir( plugin_dir.c_str() );
|
||||
#endif
|
||||
};
|
||||
|
||||
int result = apr_dso_load(&mDSOHandle,
|
||||
plugin_file.c_str(),
|
||||
gAPRPoolp);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
// Load a plugin dll/dylib/so
|
||||
// Returns 0 if successful, APR error code or error code returned from the plugin's init function on failure.
|
||||
int load(std::string &plugin_file);
|
||||
int load(const std::string& plugin_dir, std::string &plugin_file);
|
||||
|
||||
// Sends a message to the plugin.
|
||||
void sendMessage(const std::string &message);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ void LLPluginProcessChild::idle(void)
|
|||
if(!mPluginFile.empty())
|
||||
{
|
||||
mInstance = new LLPluginInstance(this);
|
||||
if(mInstance->load(mPluginFile) == 0)
|
||||
if(mInstance->load(mPluginDir, mPluginFile) == 0)
|
||||
{
|
||||
mHeartbeat.start();
|
||||
mHeartbeat.setTimerExpirySec(HEARTBEAT_SECONDS);
|
||||
|
|
@ -348,6 +348,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
|
|||
if(message_name == "load_plugin")
|
||||
{
|
||||
mPluginFile = parsed.getValue("file");
|
||||
mPluginDir = parsed.getValue("dir");
|
||||
}
|
||||
else if(message_name == "shm_add")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ private:
|
|||
LLSocket::ptr_t mSocket;
|
||||
|
||||
std::string mPluginFile;
|
||||
std::string mPluginDir;
|
||||
|
||||
LLPluginInstance *mInstance;
|
||||
|
||||
|
|
|
|||
|
|
@ -157,10 +157,11 @@ void LLPluginProcessParent::errorState(void)
|
|||
setState(STATE_ERROR);
|
||||
}
|
||||
|
||||
void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug)
|
||||
void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug)
|
||||
{
|
||||
mProcess.setExecutable(launcher_filename);
|
||||
mPluginFile = plugin_filename;
|
||||
mPluginDir = plugin_dir;
|
||||
mCPUUsage = 0.0f;
|
||||
mDebug = debug;
|
||||
setState(STATE_INITIALIZED);
|
||||
|
|
@ -445,6 +446,7 @@ void LLPluginProcessParent::idle(void)
|
|||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin");
|
||||
message.setValue("file", mPluginFile);
|
||||
message.setValue("dir", mPluginDir);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public:
|
|||
~LLPluginProcessParent();
|
||||
|
||||
void init(const std::string &launcher_filename,
|
||||
const std::string &plugin_dir,
|
||||
const std::string &plugin_filename,
|
||||
bool debug);
|
||||
|
||||
|
|
@ -151,6 +152,7 @@ private:
|
|||
LLProcessLauncher mProcess;
|
||||
|
||||
std::string mPluginFile;
|
||||
std::string mPluginDir;
|
||||
|
||||
LLPluginProcessParentOwner *mOwner;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
#include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this!
|
||||
#include "llfilepicker.h"
|
||||
#include "llnotifications.h"
|
||||
|
||||
#include "lldir_win32.h"
|
||||
#include "llevent.h" // LLSimpleListener
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lluuid.h"
|
||||
|
|
@ -1766,7 +1766,8 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
|
|||
|
||||
media_source->setTarget(target);
|
||||
|
||||
if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
|
||||
const std::string plugin_dir = gDirUtilp->getLLPluginDir();
|
||||
if (media_source->init(launcher_name, plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
|
||||
{
|
||||
return media_source;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue