From 262e6fab273e1c9716854bd3034899b05a969b1a Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 6 Mar 2002 22:27:24 +0000 Subject: [PATCH] use hash_table_replace instead of g_hash_table_insert 2002-03-06 Havoc Pennington * src/frames.c (meta_frames_manage_window): use hash_table_replace instead of g_hash_table_insert * src/main.c (main): only enable verbose/debug if you set METACITY_VERBOSE/METACITY_DEBUG * src/util.c (ensure_logfile): only use a log file if METACITY_USE_LOGFILE is set * src/display.c (meta_display_for_x_display): add warning if MetaDisplay isn't found * src/window.c (meta_window_free): add an assertion that we successfully cleared the grab window --- ChangeLog | 17 +++++++++++++++++ src/display.c | 3 +++ src/frames.c | 8 ++++---- src/main.c | 8 +++++--- src/util.c | 2 +- src/window.c | 2 ++ 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90e3b74e5..419252148 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2002-03-06 Havoc Pennington + + * src/frames.c (meta_frames_manage_window): use hash_table_replace + instead of g_hash_table_insert + + * src/main.c (main): only enable verbose/debug if you set + METACITY_VERBOSE/METACITY_DEBUG + + * src/util.c (ensure_logfile): only use a log file if + METACITY_USE_LOGFILE is set + + * src/display.c (meta_display_for_x_display): add warning if + MetaDisplay isn't found + + * src/window.c (meta_window_free): add an assertion that we + successfully cleared the grab window + 2002-03-05 Havoc Pennington Work on opaque animations more, still suck too much diff --git a/src/display.c b/src/display.c index f61ba9b63..2e387854f 100644 --- a/src/display.c +++ b/src/display.c @@ -651,6 +651,9 @@ meta_display_for_x_display (Display *xdisplay) tmp = tmp->next; } + meta_warning ("Could not find display for X display %p, probably going to crash\n", + xdisplay); + return NULL; } diff --git a/src/frames.c b/src/frames.c index 148b12c0d..67f63def1 100644 --- a/src/frames.c +++ b/src/frames.c @@ -340,9 +340,9 @@ meta_frames_ensure_layout (MetaFrames *frames, meta_pango_font_desc_get_text_height (font_desc, gtk_widget_get_pango_context (widget)); - g_hash_table_insert (frames->text_heights, - &size, - GINT_TO_POINTER (frame->text_height)); + g_hash_table_replace (frames->text_heights, + &size, + GINT_TO_POINTER (frame->text_height)); } if (pango_font_description_get_size (font_desc) != @@ -434,7 +434,7 @@ meta_frames_manage_window (MetaFrames *frames, meta_core_grab_buttons (gdk_display, frame->xwindow); - g_hash_table_insert (frames->frames, &frame->xwindow, frame); + g_hash_table_replace (frames->frames, &frame->xwindow, frame); } void diff --git a/src/main.c b/src/main.c index 9e156c518..45555a4cf 100644 --- a/src/main.c +++ b/src/main.c @@ -89,9 +89,11 @@ main (int argc, char **argv) bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - - meta_set_verbose (TRUE); - meta_set_debugging (TRUE); + + if (g_getenv ("METACITY_VERBOSE")) + meta_set_verbose (TRUE); + if (g_getenv ("METACITY_DEBUG")) + meta_set_debugging (TRUE); meta_set_syncing (g_getenv ("METACITY_SYNC") != NULL); /* Parse options lamely */ diff --git a/src/util.c b/src/util.c index 8e144fb19..04294cee9 100644 --- a/src/util.c +++ b/src/util.c @@ -37,7 +37,7 @@ static FILE* logfile = NULL; static void ensure_logfile (void) { - if (logfile == NULL) + if (logfile == NULL && g_getenv ("METACITY_USE_LOGFILE")) { char *filename = NULL; char *tmpl; diff --git a/src/window.c b/src/window.c index e8e58c52f..979dafc52 100644 --- a/src/window.c +++ b/src/window.c @@ -736,6 +736,8 @@ meta_window_free (MetaWindow *window) if (window->display->grab_window == window) meta_display_end_grab_op (window->display, meta_display_get_current_time (window->display)); + + g_assert (window->display->grab_window != window); if (window->display->focus_window == window) window->display->focus_window = NULL;