-
Notifications
You must be signed in to change notification settings - Fork 174
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
Fix unref problems with floating references #2359
Conversation
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.
Thank you very much for the patch.
If you wish your patch with the Git sign, please rebase the patch to the latest Git master updating my reviews.
Also please append a line "BUG=#2359" to your Git description .
Otherwise I can modify your patch.
When running with debug-enabled GLIB there are several critical errors output: "A floating object ... was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with g_object_ref_sink()." This change fixes this by calling `g_object_ref_sink()` before `g_object_unref()` if we have a floating reference. It also fixes another related problem where we called `g_object_unref()` on a static IBusText string (created with `ibus_text_new_from_static_string()`) for which the API documentation says not to free. Bug=ibus#2359
28b6958
to
bb88bd8
Compare
I rebased and updated my PR. |
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.
Please put the capital word 'BUG' and full URL to follow other commits.
s|Bug=#2359|BUG=https://github.com/ibus/ibus/pull/2359|
When running with debug-enabled GLIB there are several critical errors output: "A floating object ... was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with g_object_ref_sink()." This change fixes this by calling `g_object_ref_sink()` before `g_object_unref()` if we have a floating reference. It also fixes another related problem where we called `g_object_unref()` on a static IBusText string (created with `ibus_text_new_from_static_string()`) for which the API documentation says not to free. BUG=ibus#2359
bb88bd8
to
5a455b1
Compare
Ahh, sorry, I missed the fact that it's the full URL because I only looked at the commit message in GitHub 😄 |
In case anyone comes a long here as well, this is supposed to fix https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5147 |
It is? Seems like it would cause those problems rather than fix them. |
This was expected to be the case in https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5147#note_1398671 but turned out to not be the case. |
While trying to get a test client to work, I encountered some problems that this PR fixes. My test client uses
ibusimcontext.c
from the GTK client and the problems showed when I ran it with debug-enabled GLIB libraries.When running with debug-enabled GLIB there are several critical errors output: "A floating object ... was finalized. This means
that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not
owned by anyone and must be removed with g_object_ref_sink()."
This change fixes this by calling
g_object_ref_sink()
beforeg_object_unref()
if we have a floating reference.It also fixes another related problem where we called
g_object_unref()
on a static IBusText string (created withibus_text_new_from_static_string()
) for which the API documentation says not to free.