Quellcode durchsuchen

Fixed memory leak due to forgetting to move initializer code.

Hynak vor 4 Jahren
Ursprung
Commit
520ceddf48
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 3 2
      src/WallpaperEngine/Render/CContext.cpp

+ 3 - 2
src/WallpaperEngine/Render/CContext.cpp

@@ -37,6 +37,9 @@ void CContext::initializeViewports ()
 
     int fullWidth = DisplayWidth (m_display, DefaultScreen (m_display));
     int fullHeight = DisplayHeight (m_display, DefaultScreen (m_display));
+
+    m_pm = XCreatePixmap(m_display, DefaultRootWindow(m_display), fullWidth, fullHeight, 24);
+    m_gc = XCreateGC(m_display, m_pm, 0, NULL);
     XRRScreenResources* screenResources = XRRGetScreenResources (m_display, DefaultRootWindow (m_display));
 
     // there are some situations where xrandr returns null (like screen not using the extension)
@@ -96,8 +99,6 @@ void CContext::render ()
         int fullWidth = DisplayWidth (m_display, DefaultScreen (m_display));
         int fullHeight = DisplayHeight (m_display, DefaultScreen (m_display));
 
-        m_pm = XCreatePixmap(m_display, root, fullWidth, fullHeight, 24);
-        m_gc = XCreateGC(m_display, m_pm, 0, NULL);
         XFillRectangle(m_display, m_pm, m_gc, 0, 0, fullWidth, fullHeight);
 
         char* image_data;