Skip to content

Commit

Permalink
xrRender: fix crash in Linux at exit
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed May 5, 2020
1 parent 38add64 commit 2d95ed8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Include/xrRender/FactoryPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

#include "RenderFactory.h"

#ifdef __GNUC__ // At least GCC call destructor of members at call parent destructor
#define FACTORY_PTR_INSTANCIATE_GNUC(Class)\
template <>\
inline void FactoryPtr<I##Class>::CreateObject(void)\
{ m_pObject = GEnv.RenderFactory->Create##Class(); }\
template <>\
inline void FactoryPtr<I##Class>::DestroyObject(void)\
{\
m_pObject = NULL;\
}
#endif

#define FACTORY_PTR_INSTANCIATE(Class)\
template <>\
inline void FactoryPtr<I##Class>::CreateObject(void)\
Expand Down Expand Up @@ -47,7 +59,11 @@ class FactoryPtr

#ifndef _EDITOR
FACTORY_PTR_INSTANCIATE(UISequenceVideoItem)
#ifdef __GNUC__
FACTORY_PTR_INSTANCIATE_GNUC(UIShader)
#else
FACTORY_PTR_INSTANCIATE(UIShader)
#endif
FACTORY_PTR_INSTANCIATE(StatGraphRender)
FACTORY_PTR_INSTANCIATE(ConsoleRender)
#ifdef DEBUG
Expand Down

0 comments on commit 2d95ed8

Please sign in to comment.