Fix GLib warning when pressing a key with no documents open.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4017 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-07-23 17:11:31 +00:00
parent 7a77c3a214
commit 4a61fd4620
2 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,8 @@
* src/document.c, src/editor.c:
Fix scrolling horizontally after finding a search match with the
search bar or Find Next/Previous which is off-screen.
* src/keybindings.c:
Fix GLib warning when pressing a key with no documents open.
2009-07-21 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -917,12 +917,14 @@ static gboolean check_snippet_completion(GeanyDocument *doc, guint keyval, guint
GeanyKeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_EDITOR,
GEANY_KEYS_EDITOR_COMPLETESNIPPET);
g_return_val_if_fail(doc, FALSE);
if (kb->key == keyval && kb->mods == state)
{
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybinding only valid when scintilla widget has focus */
if (doc != NULL && focusw == GTK_WIDGET(doc->editor->sci))
if (focusw == GTK_WIDGET(doc->editor->sci))
{
ScintillaObject *sci = doc->editor->sci;
gint pos = sci_get_current_position(sci);
@ -1086,6 +1088,7 @@ static gboolean on_key_press_event(GtkWidget *widget, GdkEventKey *ev, gpointer
return FALSE;
doc = document_get_current();
if (doc)
document_check_disk_status(doc, FALSE);
keyval = ev->keyval;
@ -1103,7 +1106,7 @@ static gboolean on_key_press_event(GtkWidget *widget, GdkEventKey *ev, gpointer
if (vte_info.have_vte && check_vte(state, keyval))
return FALSE;
#endif
if (check_snippet_completion(doc, keyval, state))
if (doc && check_snippet_completion(doc, keyval, state))
return TRUE;
if (check_menu_key(doc, keyval, state, ev->time))
return TRUE;