Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-08-22 06:09:19 +0300
committerMike Erwin <significant.bit@gmail.com>2016-08-22 06:09:30 +0300
commit28cf9cfd15acad4c8eb2fd8a4d3df3a3905aa71e (patch)
treeedfa829c0be7df97a89bd4024ec0524e76af104e /intern/ghost
parentea69d471c89a504a71b6906ed081057dafd196d0 (diff)
NDOF: fix crash on Mac with old drivers
For best results use the latest 3Dconnexion driver. But latest is only supported on Mac OS 10.9+. We go all the way back to Mac OS 10.6 so have to deal with older driver versions. See the original dlclose line for my faulty assumption. Waiting to unload the driver later fixes the crash. Newer drivers don’t seem to have this issue. Also removed WITH_INPUT_NDOF guards as NDOFManager.h takes care of this. Follow-up to b10d005 a few days ago.
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerCocoa.mm15
1 files changed, 8 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm b/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
index b56757cd0fe..3cce6bf520b 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
+++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
@@ -21,8 +21,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef WITH_INPUT_NDOF
-
#define DEBUG_NDOF_DRIVER false
#include "GHOST_NDOFManagerCocoa.h"
@@ -115,13 +113,15 @@ static void* load_func(void* module, const char* func_name)
#define LOAD_FUNC(name) name = (name##_ptr) load_func(module, #name)
+static void* module; // handle to the whole driver
+
static bool load_driver_functions()
{
if (driver_loaded) {
return true;
}
- void* module = dlopen("3DconnexionClient.framework/3DconnexionClient", RTLD_LAZY | RTLD_LOCAL);
+ module = dlopen("3DconnexionClient.framework/3DconnexionClient", RTLD_LAZY | RTLD_LOCAL);
if (module) {
LOAD_FUNC(SetConnexionHandlers);
@@ -145,8 +145,6 @@ static bool load_driver_functions()
has_old_driver = (SetConnexionClientButtonMask == NULL);
}
-
- dlclose(module); // functions will remain loaded
}
#if DEBUG_NDOF_DRIVER
else {
@@ -161,6 +159,10 @@ static bool load_driver_functions()
return driver_loaded;
}
+static void unload_driver()
+{
+ dlclose(module);
+}
static void DeviceAdded(uint32_t unused)
{
@@ -268,6 +270,7 @@ GHOST_NDOFManagerCocoa::~GHOST_NDOFManagerCocoa()
if (driver_loaded) {
UnregisterConnexionClient(clientID);
CleanupConnexionHandlers();
+ unload_driver();
ghost_system = NULL;
ndof_manager = NULL;
@@ -278,5 +281,3 @@ bool GHOST_NDOFManagerCocoa::available()
{
return driver_loaded;
}
-
-#endif // WITH_INPUT_NDOF