From: Samuel Rødal Date: Thu, 29 Mar 2012 09:04:27 +0000 (+0200) Subject: Fixed leaking of ExtendedOutput objects in the compositor. X-Git-Tag: TIZEN~95 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc152be5f5d5c888cddb6b4e897f621f05612297;p=profile%2Fivi%2Fqtwayland.git Fixed leaking of ExtendedOutput objects in the compositor. Need to properly free them when the corresponding resource is destroyed. Change-Id: I1680a7a8b598986aace942ce647cc0f80d4c022f Reviewed-by: Laszlo Agocs --- diff --git a/src/compositor/wayland_wrapper/wlextendedoutput.cpp b/src/compositor/wayland_wrapper/wlextendedoutput.cpp index c395e67..c3b2dbc 100644 --- a/src/compositor/wayland_wrapper/wlextendedoutput.cpp +++ b/src/compositor/wayland_wrapper/wlextendedoutput.cpp @@ -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(resource->data); + delete output; + free(resource); +} + void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation) { int sendOpperation; diff --git a/src/compositor/wayland_wrapper/wlextendedoutput.h b/src/compositor/wayland_wrapper/wlextendedoutput.h index c300d9b..2d6bf51 100644 --- a/src/compositor/wayland_wrapper/wlextendedoutput.h +++ b/src/compositor/wayland_wrapper/wlextendedoutput.h @@ -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; - }; }