-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove image on buffer destroy callback only #178
Conversation
1f24536
to
5c032f7
Compare
Valgrind's traces on #175
shows that the first deletion happens during the destruction of the wl_client because a problem in the On static int
wl_client_connection_data(int fd, uint32_t mask, void *data)
{
...
if ((resource_flags & WL_MAP_ENTRY_LEGACY) ||
resource->dispatcher == NULL) {
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER,
object, opcode, client); this part of the code is reached if |
5c032f7
to
d4ab8d8
Compare
I can take a look at this later today, but @carlosgcampos and/or @zdobersek may want to comment here as well. |
We are already reviewing the patch, hopefully we will have a resolution this week. Without the option to reproduce the original problems it took some time to check the lifecycle of the object considering that image structure position between wayland and the backend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code apparently missed the situation where wayland destruction and the releaseImage happened at the same time. The places in the code that are checking if bufferResource is NULL are doing the work but was not enough, that explains previous patches. Still the code needs a better name and check for that situation, but this patch is in the right direction. We have to handle the image in the desctruction and avoid any operation when the bufferResource is gone. The option implemeted was keep the image and hope for the best.
It is a pity we can not reproduce the original valgrind stacks and crashes to verify the whole situation though.
Thanks for the patch, hopefully we can refactor this code at some point.
Thanks a lot @alexgcastro! 🤗 |
Cherry-picked into the |
…view-backend-exportable-fdo-egl Since commit b51f539 there is a memory leak each time the wl_resource is destroyed. This can be easily reproduced by repeteadly switching full-screen on/off (pressing F11 key) with Cog on Weston. The memory leak is caused because since b51f539 the wpe_fdo_egl_exported_image object is not cleaned anymore on the bufferDestroyListenerCallback callback. Commit cb6b86a fixed the leak but introduced crashes on some cases, so it was reverted. This is a new attempt at fixing this leak, this adds safeguards to ensure that the image object is not cleaned twice or with the wrong exported status. Related-to: Igalia#73 Igalia#175 Igalia#176 Igalia#178 #538
…view-backend-exportable-fdo-egl Since commit b51f539 there is a memory leak each time the wl_resource is destroyed. This can be easily reproduced by repeteadly switching full-screen on/off (pressing F11 key) with Cog on Weston. The memory leak is caused because since b51f539 the wpe_fdo_egl_exported_image object is not cleaned anymore on the bufferDestroyListenerCallback callback. Commit cb6b86a fixed the leak but introduced crashes on some cases, so it was reverted. This is a new attempt at fixing this leak, this adds safeguards to ensure that the image object is not cleaned twice or with the wrong exported status. Related-to: Igalia#73 Igalia#175 Igalia#176 Igalia#178 Related-to: Igalia/cog#538
…view-backend-exportable-fdo-egl Since commit b51f539 there is a memory leak each time the wl_resource is destroyed. This can be easily reproduced by repeteadly switching full-screen on/off (pressing F11 key) with Cog on Weston. The memory leak is caused because since b51f539 the wpe_fdo_egl_exported_image object is not cleaned anymore on the bufferDestroyListenerCallback callback. Commit cb6b86a fixed the leak but introduced crashes on some cases, so it was reverted. This is a new attempt at fixing this leak, this adds safeguards to ensure that the image object is not cleaned twice or with the wrong exported status. Related-to: #73 #175 #176 #178 Related-to: Igalia/cog#538
…view-backend-exportable-fdo-egl Since commit b51f539 there is a memory leak each time the wl_resource is destroyed. This can be easily reproduced by repeteadly switching full-screen on/off (pressing F11 key) with Cog on Weston. The memory leak is caused because since b51f539 the wpe_fdo_egl_exported_image object is not cleaned anymore on the bufferDestroyListenerCallback callback. Commit cb6b86a fixed the leak but introduced crashes on some cases, so it was reverted. This is a new attempt at fixing this leak, this adds safeguards to ensure that the image object is not cleaned twice or with the wrong exported status. Related-to: #73 #175 #176 #178 Related-to: Igalia/cog#538 (cherry picked from commit 5b1c5e4)
view-backend-exportable-fdo-egl.cpp relies on the bufferDestroyListenerCallback for destroying the image, This is called during the wl_resource_destroy() to release the image.
Related-to: #175 #176