Skip to content

Commit

Permalink
#5346: Linux compilation fixes.
Browse files Browse the repository at this point in the history
Remove libtool-generated file.
  • Loading branch information
Matthew Mott authored and codereader committed Sep 30, 2020
1 parent 4627d4c commit 9b67042
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 260 deletions.
88 changes: 44 additions & 44 deletions include/imodule.h
Expand Up @@ -340,50 +340,6 @@ namespace module
* \ingroup module
*/

// Reference container to hold the cached module references.
// It automatically invalidates its reference as soon as the IModuleRegistry
// changes its instance ID.
template<typename ModuleType>
class InstanceReference
{
private:
const char* const _moduleName;
ModuleType* _instancePtr;
IModuleRegistry::InstanceId _registryInstanceId;
public:
InstanceReference(const char* const moduleName) :
_moduleName(moduleName),
_instancePtr(nullptr),
_registryInstanceId(0)
{
acquireReference();
}

// Cast-operator used to access the module reference
inline operator ModuleType&()
{
#ifdef MODULE_REFERENCES_SUPPORT_INVALIDATION
// Check if we have an instance or if it is outdated
if (_instancePtr == nullptr ||
_registryInstanceId != GlobalModuleRegistry().getInstanceId())
{
acquireReference();
}
#endif
return *_instancePtr;
}

private:
void acquireReference()
{
_instancePtr = std::dynamic_pointer_cast<ModuleType>(
GlobalModuleRegistry().getModule(_moduleName)).get();
// Save the instance ID of the registry - if this ever changes
// the above reference is treated as invalid
_registryInstanceId = GlobalModuleRegistry().getInstanceId();
}
};

/** greebo: This is a container holding a reference to the registry.
* The getRegistry() symbol above is not exported to the
* modules in Win32 compiles. That's why this structure
Expand Down Expand Up @@ -436,6 +392,50 @@ namespace module
return !RegistryReference::Instance().isEmpty();
}

// Reference container to hold the cached module references.
// It automatically invalidates its reference as soon as the IModuleRegistry
// changes its instance ID.
template<typename ModuleType>
class InstanceReference
{
private:
const char* const _moduleName;
ModuleType* _instancePtr;
IModuleRegistry::InstanceId _registryInstanceId;
public:
InstanceReference(const char* const moduleName) :
_moduleName(moduleName),
_instancePtr(nullptr),
_registryInstanceId(0)
{
acquireReference();
}

// Cast-operator used to access the module reference
inline operator ModuleType&()
{
#ifdef MODULE_REFERENCES_SUPPORT_INVALIDATION
// Check if we have an instance or if it is outdated
if (_instancePtr == nullptr ||
_registryInstanceId != GlobalModuleRegistry().getInstanceId())
{
acquireReference();
}
#endif
return *_instancePtr;
}

private:
void acquireReference()
{
_instancePtr = std::dynamic_pointer_cast<ModuleType>(
GlobalModuleRegistry().getModule(_moduleName)).get();
// Save the instance ID of the registry - if this ever changes
// the above reference is treated as invalid
_registryInstanceId = GlobalModuleRegistry().getInstanceId();
}
};

// Exception thrown if the module being loaded is incompatible with the main binary
class ModuleCompatibilityException :
public std::runtime_error
Expand Down
4 changes: 3 additions & 1 deletion libs/module/ApplicationContextBase.cpp
Expand Up @@ -128,6 +128,8 @@ const IApplicationContext::ArgumentList& ApplicationContextBase::getCmdLineArgs(
#include <stdlib.h>
#include <pwd.h>
#include <unistd.h>
#include <limits.h>

#ifdef __APPLE__
#include <libproc.h>
#endif
Expand Down Expand Up @@ -240,7 +242,7 @@ std::string getXDGPath(const std::string& envVar, const std::string& fallback)

} // namespace

void ApplicationContextImpl::initialise(int argc, char* argv[])
void ApplicationContextBase::initialise(int argc, char* argv[])
{
// Give away unnecessary root privileges.
// Important: must be done before calling gtk_init().
Expand Down
2 changes: 1 addition & 1 deletion plugins/dm.gameconnection/clsocket/PassiveSocket.cpp
Expand Up @@ -216,7 +216,7 @@ CActiveSocket *CPassiveSocket::Accept()
{
uint32 nSockLen;
CActiveSocket *pClientSocket = NULL;
SOCKET socket = UINT_PTR(CSimpleSocket::SocketError);
SOCKET socket{CSimpleSocket::SocketError};

if (m_nSocketType != CSimpleSocket::SocketTypeTcp)
{
Expand Down
1 change: 0 additions & 1 deletion radiant/Makefile.am
Expand Up @@ -192,7 +192,6 @@ darkradiant_SOURCES = main.cpp \
textool/item/PatchItem.cpp \
textool/item/PatchVertexItem.cpp \
textool/TexTool.cpp \
modulesystem/ApplicationContextImpl.cpp \
selection/ManipulateMouseTool.cpp \
selection/SelectionMouseTools.cpp \
settings/Win32Registry.cpp \
Expand Down
2 changes: 2 additions & 0 deletions radiant/camera/tools/JumpToObjectTool.h
Expand Up @@ -7,6 +7,8 @@
#include "../GlobalCameraWndManager.h"
#include "ObjectFinder.h"

#include "math/AABB.h"

namespace ui
{

Expand Down
210 changes: 0 additions & 210 deletions radiant/darkradiant

This file was deleted.

2 changes: 2 additions & 0 deletions radiant/eventmanager/MouseToolManager.cpp
Expand Up @@ -4,6 +4,8 @@
#include "iuimanager.h"
#include "iregistry.h"
#include "itextstream.h"
#include "imainframe.h"

#include "string/convert.h"
#include "string/join.h"
#include "wxutil/MouseButton.h"
Expand Down
1 change: 1 addition & 0 deletions radiant/ui/DispatchEvent.h
@@ -1,6 +1,7 @@
#pragma once

#include <wx/event.h>
#include <functional>

namespace ui
{
Expand Down
3 changes: 3 additions & 0 deletions radiant/ui/ManipulatorToggle.h
@@ -1,6 +1,9 @@
#pragma once

#include "iselection.h"
#include "ieventmanager.h"
#include "iclipper.h"

#include <sigc++/connection.h>

namespace ui
Expand Down
2 changes: 2 additions & 0 deletions radiant/ui/overlay/Overlay.cpp
@@ -1,5 +1,7 @@
#include "Overlay.h"

#include "imainframe.h"

#include "registry/registry.h"
#include "math/Vector3.h"
#include "math/Matrix4.h"
Expand Down
2 changes: 2 additions & 0 deletions radiant/ui/script/ScriptMenu.h
@@ -1,5 +1,7 @@
#pragma once

#include <memory>

namespace ui
{

Expand Down

0 comments on commit 9b67042

Please sign in to comment.