Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

delete temporary buffer in ofAppGlutWindow #2818

Merged
merged 2 commits into from

2 participants

@saki7

This fixes #2817.

@arturoc
Owner

thanks, btw we are not using ofAppGlutWindow as default anymore, so this error is probably also in ofAppGLFWWindow, if you don't mind checking that too?

Also have you checked if this doesn't crash the application? my suspicion is that Xwindows doesn't copy that buffer and instead just uses what you pass to it so deleting it would crash the app after a while, but not sure

@saki7

I have just gone through Xlib's source, and it seems like it's copying the buffer to its internal buffer.
XChangeProperty delegates to Data and Data copies the buffer.

So it's safe to delete, I guess.

Is ofAppGlutWindow not default anymore? Could you tell me, about what time has it changed? Weeks ago or months ago?
I mainly use the latest stable release, so I'm not aware of recent changes.

I have found a same bug in ofAppGLFWWindow and just pushed the fix for it too.

@arturoc
Owner

great thanks! yes ofAppGLFWWindow is the default since 0.8.0

@arturoc arturoc merged commit e79c8ae into openframeworks:master
@saki7

Thanks for merging.
Yeah I was dumb... I actually found the error on the GLFW version and was investigating on GLUT version of the source. Lucky that you pointed it out.

@saki7 saki7 deleted the saki7:ofAppGlutWindow-leak-fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
1  libs/openFrameworks/app/ofAppGLFWWindow.cpp
@@ -266,6 +266,7 @@ void ofAppGLFWWindow::setWindowIcon(const ofPixels & iconPixels){
XChangeProperty(getX11Display(), getX11Window(), XInternAtom(getX11Display(), "_NET_WM_ICON", False), XA_CARDINAL, 32,
PropModeReplace, (const unsigned char*)buffer, length);
+ delete[] buffer;
XFlush(getX11Display());
}
#endif
View
1  libs/openFrameworks/app/ofAppGlutWindow.cpp
@@ -356,6 +356,7 @@ void ofAppGlutWindow::setWindowIcon(const ofPixels & iconPixels){
XChangeProperty(m_display, m_window, XInternAtom(m_display, "_NET_WM_ICON", False), XA_CARDINAL, 32,
PropModeReplace, (const unsigned char*)buffer, length);
+ delete[] buffer;
XFlush(m_display);
}
#endif
Something went wrong with that request. Please try again.