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
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-26 11:13:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-26 11:13:42 +0300
commit02a7063a0922c6c59a9f71ea2627e4f211a79899 (patch)
tree230ed5a6652bbd3ac16d4bb060d451301395c7fd /intern
parentd53a0cd48f5e9293a9e08252d261c830c34f532c (diff)
fix for blenderplayer crashing on exit.
the event consumer was being freed twice, once when going out of C++ scope, another when freeing the system.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_C-api.h11
-rw-r--r--intern/ghost/GHOST_ISystem.h9
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_System.cpp11
-rw-r--r--intern/ghost/intern/GHOST_System.h7
5 files changed, 42 insertions, 3 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index e1464542ed3..be8dc138797 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -262,7 +262,16 @@ extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle);
*/
extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
GHOST_EventConsumerHandle consumerhandle);
-
+
+/**
+ * Remove the given event consumer to our list.
+ * @param systemhandle The handle to the system
+ * @param consumerhandle The event consumer to remove.
+ * @return Indication of success.
+ */
+extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle,
+ GHOST_EventConsumerHandle consumerhandle);
+
/***************************************************************************************
** Progress bar functionality
***************************************************************************************/
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 7e1300d780a..38c732153d7 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -290,7 +290,14 @@ public:
* @return Indication of success.
*/
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer) = 0;
-
+
+ /**
+ * Removes the given event consumer to our list.
+ * @param consumer The event consumer to remove.
+ * @return Indication of success.
+ */
+ virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer) = 0;
+
/***************************************************************************************
** N-degree of freedom device management functionality
***************************************************************************************/
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 20caa057be0..28058c60499 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -253,6 +253,13 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve
return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
}
+GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
+{
+ GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
+
+ return system->removeEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
+}
+
GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle,float progress)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index ce492c2903b..559fb65277d 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -226,6 +226,17 @@ GHOST_TSuccess GHOST_System::addEventConsumer(GHOST_IEventConsumer* consumer)
return success;
}
+GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer* consumer)
+{
+ GHOST_TSuccess success;
+ if (m_eventManager) {
+ success = m_eventManager->removeConsumer(consumer);
+ }
+ else {
+ success = GHOST_kFailure;
+ }
+ return success;
+}
GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
{
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 1f2199855fa..b5c64bfceb6 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -183,7 +183,12 @@ public:
*/
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer);
-
+ /**
+ * Remove the given event consumer to our list.
+ * @param consumer The event consumer to remove.
+ * @return Indication of success.
+ */
+ virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer);
/***************************************************************************************
** N-degree of freedom devcice management functionality