GNOME Bugzilla – Bug 107889
gtk-demo segfaults when Ctrl-A is pressed in source browser window
Last modified: 2011-02-04 16:11:59 UTC
Also crashes in garnome-0.21.2. Running gtk-demo, picking the Source tab and pressing Ctrl-A dumps core.
Hmm, I don't see the crash on the stable branch; it probably got fixed by the following commit: 2003-02-14 Matthias Clasen <maclas@gmx.de> * gtk/gtktextview.c (popup_targets_received): Remove bogus GTK_OBJECT cast. Hopefully got it right now... (gtk_text_view_move_cursor_internal): Add a default: to avoid compiler warnings. But even if it doesn't crash, C-a is not working if the cursor is not visible. This got broken by my changes to switch move_cursor_internal to viewport-based movements when the cursor is not visible. I guess the right fix is to introduce a separate binding signal for select_all.
Created attachment 14875 [details] [review] patch
Here is a patch for 2.2. For head, it will have to be combined with the viewport-movement patch for 2.4, which is attached to bug 78669.
Created attachment 14884 [details] gtk-demo crash backtrace
I have attached a backtrace in case that might be useful.
I'd like to get this fix into 2.2.2 to avoid the regression on C-a. What do you think, Havoc ?
It's not clear to me what the above has to do with the crash... But as for not working, well, it makes me a bit sad to see the "elegant" approach of composing select-all out of multiple primitive operations, but yeah, this change is probably right. I don't see any problem with adding a new binding signal for 2.2.2. The "select" parameter, however confuses me: What's the meaning of this parameter? If select all from the menu or from the keyboard has different effects on the primary selection, that's broken. I doubt the explicit call to gtk_text_buffer_copy_clipboard() in select_all_cb was needed, since change the selection should automatically update the primary selection. You probably can use append_action_signal() for select_all with this change if the select paramter isn't needed?. (No big win, but increases consistency of the code a bit.) of the code a bit?)
The crash was caused by a missing default: clause which I added on 2003-02-14. The patch we're discussing here has nothing to do with the crash; it is about restoring the functionality of C-a in invisible cursor mode. The "select" parameter is about select-all vs. unselect-all. Note that gtk_text_view_select_all (..., FALSE) is used for C-\
*** Bug 111411 has been marked as a duplicate of this bug. ***
A bit weird to have a 'select-all' callback be able to also unselect-all, but not completely ridiculous. The patch looks OK to me, though my comment about gtk_text_buffer_copy_clipboard() still stands.
You were right, the copy_clipboard call was unnecessary. Committed to both branches.