sizeof() was being used incorrectly to clear X11 m_keyboard_vector, would only have...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 1 Aug 2009 09:07:45 +0000 (09:07 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 1 Aug 2009 09:07:45 +0000 (09:07 +0000)
fix for harmless memleak too.

intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_SystemX11.h

index e7e47a6bf3830165b2f63401dac87478c8e5eae1..25e60002de0992b434e070a15d9714c55fe85c97 100644 (file)
@@ -145,11 +145,9 @@ init(
        GHOST_TSuccess success = GHOST_System::init();
 
        if (success) {
-               m_keyboard_vector = new char[32];
-
                m_displayManager = new GHOST_DisplayManagerX11(this);
 
-               if (m_keyboard_vector && m_displayManager) {
+               if (m_displayManager) {
                        return GHOST_kSuccess;
                }
        }
@@ -672,9 +670,9 @@ getModifierKeys(
 
        // analyse the masks retuned from XQueryPointer.
 
-       memset(m_keyboard_vector,0,sizeof(m_keyboard_vector));
+       memset((void *)m_keyboard_vector,0,sizeof(m_keyboard_vector));
 
-       XQueryKeymap(m_display,m_keyboard_vector);
+       XQueryKeymap(m_display,(char *)m_keyboard_vector);
 
        // now translate key symobols into keycodes and
        // test with vector.
index 6a2c81c09a78dac1ce15d34a13db3ea877f02fcb..58017bd23921973a2795dadf2dac827a631c8e46 100644 (file)
@@ -246,7 +246,7 @@ private :
        GHOST_TUns64 m_start_time;
 
        /// A vector of keyboard key masks
-       char *m_keyboard_vector;
+       char m_keyboard_vector[32];
 
        /**
         * Return the ghost window associated with the