mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
global/static QStrings in plugins appear to cause crashes during shutdown
This commit is contained in:
parent
804f25740d
commit
9868ddd602
21 changed files with 57 additions and 57 deletions
|
@ -18,7 +18,7 @@ class Basic2DWindowOpenGLDisplayPlugin : public OpenGLDisplayPlugin {
|
|||
Q_OBJECT
|
||||
using Parent = OpenGLDisplayPlugin;
|
||||
public:
|
||||
virtual const QString& getName() const override { return NAME; }
|
||||
virtual const QString getName() const override { return NAME; }
|
||||
|
||||
virtual float getTargetFrameRate() const override { return _framerateTarget ? (float) _framerateTarget : TARGET_FRAMERATE_Basic2DWindowOpenGL; }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class NullDisplayPlugin : public DisplayPlugin {
|
||||
public:
|
||||
~NullDisplayPlugin() final {}
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
grouping getGrouping() const override { return DEVELOPER; }
|
||||
|
||||
glm::uvec2 getRecommendedRenderSize() const override;
|
||||
|
|
|
@ -13,7 +13,7 @@ class DebugHmdDisplayPlugin : public HmdDisplayPlugin {
|
|||
using Parent = HmdDisplayPlugin;
|
||||
|
||||
public:
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
grouping getGrouping() const override { return DEVELOPER; }
|
||||
|
||||
bool isSupported() const override;
|
||||
|
|
|
@ -13,7 +13,7 @@ class InterleavedStereoDisplayPlugin : public StereoDisplayPlugin {
|
|||
Q_OBJECT
|
||||
using Parent = StereoDisplayPlugin;
|
||||
public:
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
grouping getGrouping() const override { return ADVANCED; }
|
||||
glm::uvec2 getRecommendedRenderSize() const override;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class SideBySideStereoDisplayPlugin : public StereoDisplayPlugin {
|
|||
Q_OBJECT
|
||||
using Parent = StereoDisplayPlugin;
|
||||
public:
|
||||
virtual const QString& getName() const override { return NAME; }
|
||||
virtual const QString getName() const override { return NAME; }
|
||||
virtual grouping getGrouping() const override { return ADVANCED; }
|
||||
virtual glm::uvec2 getRecommendedRenderSize() const override;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <PathUtils.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
const QString KeyboardMouseDevice::NAME = "Keyboard/Mouse";
|
||||
const char* KeyboardMouseDevice::NAME = "Keyboard/Mouse";
|
||||
bool KeyboardMouseDevice::_enableTouch = true;
|
||||
|
||||
void KeyboardMouseDevice::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
||||
|
|
|
@ -52,21 +52,21 @@ public:
|
|||
MOUSE_AXIS_WHEEL_X_POS,
|
||||
MOUSE_AXIS_WHEEL_X_NEG,
|
||||
};
|
||||
|
||||
|
||||
enum TouchAxisChannel {
|
||||
TOUCH_AXIS_X_POS = MOUSE_AXIS_WHEEL_X_NEG + 1,
|
||||
TOUCH_AXIS_X_NEG,
|
||||
TOUCH_AXIS_Y_POS,
|
||||
TOUCH_AXIS_Y_NEG,
|
||||
};
|
||||
|
||||
|
||||
enum TouchButtonChannel {
|
||||
TOUCH_BUTTON_PRESS = TOUCH_AXIS_Y_NEG + 1,
|
||||
};
|
||||
|
||||
// Plugin functions
|
||||
bool isSupported() const override { return true; }
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
|
||||
bool isHandController() const override { return false; }
|
||||
|
||||
|
@ -88,8 +88,8 @@ public:
|
|||
void wheelEvent(QWheelEvent* event);
|
||||
|
||||
static void enableTouch(bool enableTouch) { _enableTouch = enableTouch; }
|
||||
|
||||
static const QString NAME;
|
||||
|
||||
static const char* NAME;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <PathUtils.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
const QString TouchscreenDevice::NAME = "Touchscreen";
|
||||
const char* TouchscreenDevice::NAME = "Touchscreen";
|
||||
|
||||
bool TouchscreenDevice::isSupported() const {
|
||||
for (auto touchDevice : QTouchDevice::devices()) {
|
||||
|
|
|
@ -22,7 +22,7 @@ class QGestureEvent;
|
|||
class TouchscreenDevice : public InputPlugin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
|
||||
enum TouchAxisChannel {
|
||||
TOUCH_AXIS_X_POS = 0,
|
||||
TOUCH_AXIS_X_NEG,
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
// Plugin functions
|
||||
virtual bool isSupported() const override;
|
||||
virtual const QString& getName() const override { return NAME; }
|
||||
virtual const QString getName() const override { return NAME; }
|
||||
|
||||
bool isHandController() const override { return false; }
|
||||
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
void touchEndEvent(const QTouchEvent* event);
|
||||
void touchUpdateEvent(const QTouchEvent* event);
|
||||
void touchGestureEvent(const QGestureEvent* event);
|
||||
|
||||
static const QString NAME;
|
||||
|
||||
static const char* NAME;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
#include "Plugin.h"
|
||||
|
||||
QString Plugin::UNKNOWN_PLUGIN_ID("unknown");
|
||||
const char* Plugin::UNKNOWN_PLUGIN_ID { "unknown" };
|
||||
|
||||
void Plugin::setContainer(PluginContainer* container) {
|
||||
_container = container;
|
||||
|
|
|
@ -18,7 +18,7 @@ class Plugin : public QObject {
|
|||
Q_OBJECT
|
||||
public:
|
||||
/// \return human-readable name
|
||||
virtual const QString& getName() const = 0;
|
||||
virtual const QString getName() const = 0;
|
||||
|
||||
typedef enum { STANDARD, ADVANCED, DEVELOPER } grouping;
|
||||
|
||||
|
@ -26,10 +26,10 @@ public:
|
|||
virtual grouping getGrouping() const { return STANDARD; }
|
||||
|
||||
/// \return string ID (not necessarily human-readable)
|
||||
virtual const QString& getID() const { assert(false); return UNKNOWN_PLUGIN_ID; }
|
||||
virtual const QString getID() const { assert(false); return UNKNOWN_PLUGIN_ID; }
|
||||
|
||||
virtual bool isSupported() const;
|
||||
|
||||
|
||||
void setContainer(PluginContainer* container);
|
||||
|
||||
/// Called when plugin is initially loaded, typically at application start
|
||||
|
@ -74,6 +74,6 @@ signals:
|
|||
protected:
|
||||
bool _active { false };
|
||||
PluginContainer* _container { nullptr };
|
||||
static QString UNKNOWN_PLUGIN_ID;
|
||||
static const char* UNKNOWN_PLUGIN_ID;
|
||||
|
||||
};
|
||||
|
|
|
@ -23,12 +23,12 @@ namespace hifi {
|
|||
using Builder = std::function<Pointer()>;
|
||||
using BuilderMap = std::map<Key, Builder>;
|
||||
|
||||
void registerBuilder(const Key& name, Builder builder) {
|
||||
void registerBuilder(const Key name, Builder builder) {
|
||||
// FIXME don't allow name collisions
|
||||
_builders[name] = builder;
|
||||
}
|
||||
|
||||
Pointer create(const Key& name) const {
|
||||
Pointer create(const Key name) const {
|
||||
const auto& entryIt = _builders.find(name);
|
||||
if (entryIt != _builders.end()) {
|
||||
return (*entryIt).second();
|
||||
|
@ -39,7 +39,7 @@ namespace hifi {
|
|||
template <typename Impl>
|
||||
class Registrar {
|
||||
public:
|
||||
Registrar(const Key& name, SimpleFactory& factory) {
|
||||
Registrar(const Key name, SimpleFactory& factory) {
|
||||
factory.registerBuilder(name, [] { return std::make_shared<Impl>(); });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "HiFiCodec.h"
|
||||
|
||||
const QString HiFiCodec::NAME = "hifiAC";
|
||||
const char* HiFiCodec::NAME { "hifiAC" };
|
||||
|
||||
void HiFiCodec::init() {
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
class HiFiCodec : public CodecPlugin {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
// Plugin functions
|
||||
bool isSupported() const override;
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
|
||||
void init() override;
|
||||
void deinit() override;
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
virtual void releaseDecoder(Decoder* decoder) override;
|
||||
|
||||
private:
|
||||
static const QString NAME;
|
||||
static const char* NAME;
|
||||
};
|
||||
|
||||
#endif // hifi_HiFiCodec_h
|
||||
|
|
|
@ -29,7 +29,7 @@ class Joystick : public QObject, public controller::InputDevice {
|
|||
public:
|
||||
using Pointer = std::shared_ptr<Joystick>;
|
||||
|
||||
const QString& getName() const { return _name; }
|
||||
const QString getName() const { return _name; }
|
||||
|
||||
SDL_GameController* getGameController() { return _sdlGameController; }
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static_assert(
|
|||
"SDL2 equvalence: Enums and values from StandardControls.h are assumed to match enums from SDL_gamecontroller.h");
|
||||
|
||||
|
||||
const QString SDL2Manager::NAME = "SDL2";
|
||||
const char* SDL2Manager::NAME = "SDL2";
|
||||
|
||||
SDL_JoystickID SDL2Manager::getInstanceId(SDL_GameController* controller) {
|
||||
SDL_Joystick* joystick = SDL_GameControllerGetJoystick(controller);
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
class SDL2Manager : public InputPlugin {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
// Plugin functions
|
||||
bool isSupported() const override;
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
|
||||
QStringList getSubdeviceNames() override;
|
||||
bool isHandController() const override { return false; }
|
||||
|
@ -39,14 +39,14 @@ public:
|
|||
|
||||
void pluginFocusOutEvent() override;
|
||||
void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) override;
|
||||
|
||||
|
||||
signals:
|
||||
void joystickAdded(Joystick* joystick);
|
||||
void joystickRemoved(Joystick* joystick);
|
||||
|
||||
|
||||
private:
|
||||
SDL_JoystickID getInstanceId(SDL_GameController* controller);
|
||||
|
||||
|
||||
int axisInvalid() const { return SDL_CONTROLLER_AXIS_INVALID; }
|
||||
int axisLeftX() const { return SDL_CONTROLLER_AXIS_LEFTX; }
|
||||
int axisLeftY() const { return SDL_CONTROLLER_AXIS_LEFTY; }
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
int axisTriggerLeft() const { return SDL_CONTROLLER_AXIS_TRIGGERLEFT; }
|
||||
int axisTriggerRight() const { return SDL_CONTROLLER_AXIS_TRIGGERRIGHT; }
|
||||
int axisMax() const { return SDL_CONTROLLER_AXIS_MAX; }
|
||||
|
||||
|
||||
int buttonInvalid() const { return SDL_CONTROLLER_BUTTON_INVALID; }
|
||||
int buttonFaceBottom() const { return SDL_CONTROLLER_BUTTON_A; }
|
||||
int buttonFaceRight() const { return SDL_CONTROLLER_BUTTON_B; }
|
||||
|
@ -73,13 +73,13 @@ private:
|
|||
int buttonDpadLeft() const { return SDL_CONTROLLER_BUTTON_DPAD_LEFT; }
|
||||
int buttonDpadRight() const { return SDL_CONTROLLER_BUTTON_DPAD_RIGHT; }
|
||||
int buttonMax() const { return SDL_CONTROLLER_BUTTON_MAX; }
|
||||
|
||||
|
||||
int buttonPressed() const { return SDL_PRESSED; }
|
||||
int buttonRelease() const { return SDL_RELEASED; }
|
||||
|
||||
QMap<SDL_JoystickID, Joystick::Pointer> _openJoysticks;
|
||||
bool _isInitialized { false } ;
|
||||
static const QString NAME;
|
||||
static const char* NAME;
|
||||
QStringList _subdeviceNames;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,15 +55,15 @@ bool SixenseManager::_sixenseLoaded = false;
|
|||
|
||||
|
||||
|
||||
const QString SixenseManager::NAME = "Sixense";
|
||||
const QString SixenseManager::HYDRA_ID_STRING = "Razer Hydra";
|
||||
const char* SixenseManager::NAME { "Sixense" };
|
||||
const char* SixenseManager::HYDRA_ID_STRING { "Razer Hydra" };
|
||||
|
||||
const QString MENU_PARENT = "Developer";
|
||||
const QString MENU_NAME = "Sixense";
|
||||
const QString MENU_PATH = MENU_PARENT + ">" + MENU_NAME;
|
||||
const QString TOGGLE_SMOOTH = "Smooth Sixense Movement";
|
||||
const QString SHOW_DEBUG_RAW = "Debug Draw Raw Data";
|
||||
const QString SHOW_DEBUG_CALIBRATED = "Debug Draw Calibrated Data";
|
||||
const char* MENU_PARENT { "Developer" };
|
||||
const char* MENU_NAME { "Sixense" };
|
||||
const char* MENU_PATH { "Developer" ">" "Sixense" };
|
||||
const char* TOGGLE_SMOOTH { "Smooth Sixense Movement" };
|
||||
const char* SHOW_DEBUG_RAW { "Debug Draw Raw Data" };
|
||||
const char* SHOW_DEBUG_CALIBRATED { "Debug Draw Calibrated Data" };
|
||||
|
||||
bool SixenseManager::isSupported() const {
|
||||
#if defined(HAVE_SIXENSE) && !defined(Q_OS_OSX)
|
||||
|
|
|
@ -28,8 +28,8 @@ class SixenseManager : public InputPlugin {
|
|||
public:
|
||||
// Plugin functions
|
||||
virtual bool isSupported() const override;
|
||||
virtual const QString& getName() const override { return NAME; }
|
||||
virtual const QString& getID() const override { return HYDRA_ID_STRING; }
|
||||
virtual const QString getName() const override { return NAME; }
|
||||
virtual const QString getID() const override { return HYDRA_ID_STRING; }
|
||||
|
||||
// Sixense always seems to initialize even if the hydras are not present. Is there
|
||||
// a way we can properly detect whether the hydras are present?
|
||||
|
@ -92,8 +92,8 @@ private:
|
|||
|
||||
std::shared_ptr<InputDevice> _inputDevice { std::make_shared<InputDevice>() };
|
||||
|
||||
static const QString NAME;
|
||||
static const QString HYDRA_ID_STRING;
|
||||
static const char* NAME;
|
||||
static const char* HYDRA_ID_STRING;
|
||||
|
||||
static bool _sixenseLoaded;
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "PCMCodecManager.h"
|
||||
|
||||
const QString PCMCodec::NAME = "pcm";
|
||||
const char* PCMCodec::NAME { "pcm" };
|
||||
|
||||
void PCMCodec::init() {
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void PCMCodec::releaseDecoder(Decoder* decoder) {
|
|||
// do nothing
|
||||
}
|
||||
|
||||
const QString zLibCodec::NAME = "zlib";
|
||||
const char* zLibCodec::NAME { "zlib" };
|
||||
|
||||
void zLibCodec::init() {
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
class PCMCodec : public CodecPlugin, public Encoder, public Decoder {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
// Plugin functions
|
||||
bool isSupported() const override;
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
|
||||
void init() override;
|
||||
void deinit() override;
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
virtual void trackLostFrames(int numFrames) override { }
|
||||
|
||||
private:
|
||||
static const QString NAME;
|
||||
static const char* NAME;
|
||||
};
|
||||
|
||||
class zLibCodec : public CodecPlugin, public Encoder, public Decoder {
|
||||
|
@ -54,7 +54,7 @@ class zLibCodec : public CodecPlugin, public Encoder, public Decoder {
|
|||
public:
|
||||
// Plugin functions
|
||||
bool isSupported() const override;
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString getName() const override { return NAME; }
|
||||
|
||||
void init() override;
|
||||
void deinit() override;
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
virtual void trackLostFrames(int numFrames) override { }
|
||||
|
||||
private:
|
||||
static const QString NAME;
|
||||
static const char* NAME;
|
||||
};
|
||||
|
||||
#endif // hifi__PCMCodecManager_h
|
||||
|
|
Loading…
Reference in a new issue