Fixed leaking of ExtendedOutput objects in the compositor.
authorSamuel Rødal <samuel.rodal@nokia.com>
Thu, 29 Mar 2012 09:04:27 +0000 (11:04 +0200)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Thu, 29 Mar 2012 09:10:57 +0000 (11:10 +0200)
Need to properly free them when the corresponding resource is destroyed.

Change-Id: I1680a7a8b598986aace942ce647cc0f80d4c022f
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
src/compositor/wayland_wrapper/wlextendedoutput.cpp
src/compositor/wayland_wrapper/wlextendedoutput.h

index c395e67..c3b2dbc 100644 (file)
@@ -78,9 +78,18 @@ ExtendedOutput::ExtendedOutput(struct wl_client *client, uint32_t id, Output *ou
     Q_ASSERT(m_output->extendedOutput() == 0);
     m_output->setExtendedOutput(this);
     m_extended_output_resource = wl_client_add_object(client,&wl_extended_output_interface,0,id,this);
+    m_extended_output_resource->destroy = ExtendedOutput::destroy_resource;
+
     sendOutputOrientation(m_compositor->screenOrientation());
 }
 
+void ExtendedOutput::destroy_resource(wl_resource *resource)
+{
+    ExtendedOutput *output = static_cast<ExtendedOutput *>(resource->data);
+    delete output;
+    free(resource);
+}
+
 void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation)
 {
     int sendOpperation;
index c300d9b..2d6bf51 100644 (file)
@@ -76,11 +76,12 @@ public:
 
     void sendOutputOrientation(Qt::ScreenOrientation orientation);
 
+    static void destroy_resource(wl_resource *resource);
+
 private:
     struct wl_resource *m_extended_output_resource;
     Output *m_output;
     Compositor *m_compositor;
-
 };
 
 }