After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 572478 - Emission of "changed" when selection was changed from "invalid" (index of -1) to "invalid" (index of -1) in a GtkComboBox
Emission of "changed" when selection was changed from "invalid" (index of -1)...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.15.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-02-19 19:32 UTC by Michael Hasselmann
Modified: 2009-03-04 16:58 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
Test case for a recursive emission of "changed" signals. (829 bytes, text/x-csrc)
2009-02-19 19:34 UTC, Michael Hasselmann
  Details
Patch to add a check when an already invalid selection was set to invalid. (1.02 KB, patch)
2009-02-19 19:43 UTC, Michael Hasselmann
none Details | Review
Better testcase that requires no user interaction. (1.63 KB, text/x-csrc)
2009-02-20 10:49 UTC, Michael Hasselmann
  Details
Better testcase that requires no user interaction (duplicated attachment, sorry). (1.63 KB, text/x-csrc)
2009-02-20 10:50 UTC, Michael Hasselmann
  Details
This patch removes a critical bug introduced with the last patch (1.40 KB, patch)
2009-02-20 11:00 UTC, Michael Hasselmann
committed Details | Review

Description Michael Hasselmann 2009-02-19 19:32:43 UTC
Please describe the problem:
gtk_combo_box_set_active passes a NULL path to gtk_combo_box_set_active_internal if an index of -1 was used. That NULL path is then used in gtk_combo_box_set_active_internal to check whether a selection should be invalid. However, it is not checked whether the selection was already invalid. This leads to the emission of a "changed" signal even though there was no change.

Steps to reproduce:
1. Compile the test code from the attachment.
2. Run it and select the first entry in the GtkComboBox.



Actual results:
The test application SEGVs.

Expected results:
The selection should be invalidated only once.

Does this happen every time?
Yes.

Other information:
Comment 1 Michael Hasselmann 2009-02-19 19:34:37 UTC
Created attachment 129091 [details]
Test case for a recursive emission of "changed" signals.
Comment 2 Michael Hasselmann 2009-02-19 19:43:36 UTC
Created attachment 129092 [details] [review]
Patch to add a check when an already invalid selection was set to invalid.
Comment 3 Michael Hasselmann 2009-02-20 10:49:23 UTC
Created attachment 129134 [details]
Better testcase that requires no user interaction.
Comment 4 Michael Hasselmann 2009-02-20 10:50:30 UTC
Created attachment 129135 [details]
Better testcase that requires no user interaction (duplicated attachment, sorry).
Comment 5 Michael Hasselmann 2009-02-20 11:00:57 UTC
Created attachment 129136 [details] [review]
This patch removes a critical bug introduced with the last patch

The previous patch stopped signal emission not only for "invalid" to "invalid", but for every change to "invalid".
Comment 6 Matthias Clasen 2009-02-22 06:17:46 UTC
Looks correct now, please commit.
Comment 7 Murray Cumming 2009-02-22 17:26:42 UTC
This is _Michael_ Hasselmann. He doesn't have commit rights.
Comment 8 Mathias Hasselmann (IRC: tbf) 2009-02-22 17:28:55 UTC
Murray, I've commited the patch for him.
Let Michael the honour to close his first accepted bugfix.
Comment 9 Mathias Hasselmann (IRC: tbf) 2009-02-22 21:16:07 UTC
.
Comment 10 Matthias Clasen 2009-02-23 02:00:51 UTC
Murray, I use the 'accepted-commit-now' status also as a tool for myself. Don't be alarmed if I set it on patches of people without commit rights. The patches will make it in before the next release.
Comment 11 Michael Hasselmann 2009-03-04 16:42:14 UTC
This bugfix triggered a regression in the GtkComboBoxEntry widget: http://bugzilla.gnome.org/show_bug.cgi?id=574059 The offending source: http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtkcomboboxentry.c?revision=20927&view=markup#l288