forked from bartvdbraak/blender
fix for ghost memory leaks
- ghost data wasn't being freed (added wm_ghost_exit() call to wm_init_exit.c) - GHOST_EventManager wasn't freeing GHOST_IEventConsumer's - ghost/X11 wasnt calling XCloseDisplay(), some junk from X11 wasnt being freed - ghost/X11 XAllocNamedColor wasn't freeing the colors when done making a custom cursor.
This commit is contained in:
parent
2a999890fb
commit
8aa3383408
@ -51,6 +51,15 @@ GHOST_EventManager::GHOST_EventManager()
|
||||
GHOST_EventManager::~GHOST_EventManager()
|
||||
{
|
||||
disposeEvents();
|
||||
|
||||
TConsumerVector::iterator iter= m_consumers.begin();
|
||||
while (iter != m_consumers.end())
|
||||
{
|
||||
GHOST_IEventConsumer* consumer = *iter;
|
||||
delete consumer;
|
||||
m_consumers.erase(iter);
|
||||
iter = m_consumers.begin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,6 +148,13 @@ GHOST_SystemX11(
|
||||
|
||||
}
|
||||
|
||||
GHOST_SystemX11::
|
||||
~GHOST_SystemX11()
|
||||
{
|
||||
XCloseDisplay(m_display);
|
||||
}
|
||||
|
||||
|
||||
GHOST_TSuccess
|
||||
GHOST_SystemX11::
|
||||
init(
|
||||
|
@ -59,6 +59,12 @@ public:
|
||||
GHOST_SystemX11(
|
||||
);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_SystemX11();
|
||||
|
||||
|
||||
GHOST_TSuccess
|
||||
init(
|
||||
);
|
||||
|
@ -54,6 +54,7 @@ GHOST_WindowManager::GHOST_WindowManager() :
|
||||
|
||||
GHOST_WindowManager::~GHOST_WindowManager()
|
||||
{
|
||||
/* m_windows is freed by GHOST_System::disposeWindow */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1325,13 +1325,12 @@ setWindowCustomCursorShape(
|
||||
int fg_color,
|
||||
int bg_color
|
||||
){
|
||||
Colormap colormap= DefaultColormap(m_display, DefaultScreen(m_display));
|
||||
Pixmap bitmap_pix, mask_pix;
|
||||
XColor fg, bg;
|
||||
|
||||
if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
|
||||
"White", &fg, &fg) == 0) return GHOST_kFailure;
|
||||
if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
|
||||
"Black", &bg, &bg) == 0) return GHOST_kFailure;
|
||||
if(XAllocNamedColor(m_display, colormap, "White", &fg, &fg) == 0) return GHOST_kFailure;
|
||||
if(XAllocNamedColor(m_display, colormap, "Black", &bg, &bg) == 0) return GHOST_kFailure;
|
||||
|
||||
if (m_custom_cursor) {
|
||||
XFreeCursor(m_display, m_custom_cursor);
|
||||
@ -1347,6 +1346,9 @@ setWindowCustomCursorShape(
|
||||
XFreePixmap(m_display, bitmap_pix);
|
||||
XFreePixmap(m_display, mask_pix);
|
||||
|
||||
XFreeColors(m_display, colormap, &fg.pixel, 1, 0L);
|
||||
XFreeColors(m_display, colormap, &bg.pixel, 1, 0L);
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
|
@ -274,6 +274,8 @@ void WM_exit(bContext *C)
|
||||
|
||||
RNA_exit();
|
||||
|
||||
wm_ghost_exit();
|
||||
|
||||
CTX_free(C);
|
||||
|
||||
if(MEM_get_memory_blocks_in_use()!=0) {
|
||||
|
@ -756,6 +756,14 @@ void wm_ghost_init(bContext *C)
|
||||
}
|
||||
}
|
||||
|
||||
void wm_ghost_exit(void)
|
||||
{
|
||||
if(g_system)
|
||||
GHOST_DisposeSystem(g_system);
|
||||
|
||||
g_system= NULL;
|
||||
}
|
||||
|
||||
/* **************** timer ********************** */
|
||||
|
||||
/* to (de)activate running timers temporary */
|
||||
|
@ -33,6 +33,7 @@ struct bScreen;
|
||||
|
||||
/* *************** internal api ************** */
|
||||
void wm_ghost_init (bContext *C);
|
||||
void wm_ghost_exit(void);
|
||||
|
||||
wmWindow *wm_window_new (bContext *C);
|
||||
void wm_window_free (bContext *C, wmWindow *win);
|
||||
|
Loading…
Reference in New Issue
Block a user