Permalink
Browse files

--The super dooper bug fix checkin--

configure.in: Compile with -funsigned-char if possible to avoid nasty bugs.
dcc.c: Fix CP1255 also in dcc chat [1122089].
inet.h: Cleanup the would_block() macros. WSATRY_AGAIN was wrong, that's only for DNS.
inbound.c/fe-gtk.c/maingui.c: Flash/highlight fixes (Lian Wan Situ).
maingui.c: Fix another Ctrl-I crasher. Fix leak of xtext buffer when toplevel windows are closed. Fix leak of GtkMenu popup.
menu.c: Fix Gtkmenu popup leak, nickname leaks.
userlistgui.c: Fix nickname leak on right-click.


git-svn-id: https://xchat.svn.sourceforge.net/svnroot/xchat@816 893a96be-7f27-4fdf-9d1e-6aeec9d3cce1
  • Loading branch information...
1 parent 2170524 commit e0374f934997936479f903ceb1ebe754cbe3139b zed committed Sep 3, 2005
Showing with 65 additions and 32 deletions.
  1. +23 −1 configure.in
  2. +8 −3 src/common/dcc.c
  3. +0 −8 src/common/inbound.c
  4. +1 −4 src/common/inet.h
  5. +1 −1 src/common/server.c
  6. +2 −0 src/fe-gtk/fe-gtk.c
  7. +13 −5 src/fe-gtk/maingui.c
  8. +14 −10 src/fe-gtk/menu.c
  9. +3 −0 src/fe-gtk/userlistgui.c
View
@@ -563,7 +563,7 @@ if test "x$GCC" = "xyes"; then
fi
fi
-# does this compiler support -Wno-pointer-sign ?
+dnl does this compiler support -Wno-pointer-sign ?
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
safe_CFLAGS=$CFLAGS
@@ -585,6 +585,28 @@ if test x$no_pointer_sign = xyes; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
+dnl does this compiler support -funsigned-char ?
+AC_MSG_CHECKING([if gcc accepts -funsigned-char ])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-funsigned-char"
+
+AC_TRY_COMPILE(, [
+int main () { return 0 ; }
+],
+[
+unsigned_char=yes
+AC_MSG_RESULT([yes])
+], [
+unsigned_char=no
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+if test x$unsigned_char = xyes; then
+ CFLAGS="$CFLAGS -funsigned-char"
+fi
+
dnl *********************************************************************
dnl ** FUNCTIONS/LIBS/CFLAGS ********************************************
dnl *********************************************************************
View
@@ -469,6 +469,8 @@ dcc_chat_line (struct DCC *dcc, char *line, char *tbuf)
gsize utf_len;
len = strlen (line);
+ if (dcc->serv->using_cp1255)
+ len++; /* include the NUL terminator */
if (dcc->serv->encoding == NULL) /* system */
utf = g_locale_to_utf8 (line, len, NULL, &utf_len, NULL);
@@ -481,6 +483,9 @@ dcc_chat_line (struct DCC *dcc, char *line, char *tbuf)
len = utf_len;
}
+ if (dcc->serv->using_cp1255 && len > 0)
+ len--;
+
/* we really need valid UTF-8 now */
conv = text_validate (&line, &len);
@@ -564,7 +569,7 @@ dcc_read_chat (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
if (len < 0)
{
- if (would_block_again ())
+ if (would_block ())
return TRUE;
}
sprintf (tbuf, "%d", dcc->port);
@@ -708,7 +713,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
if (n < 0)
{
- if (would_block_again ())
+ if (would_block ())
{
if (need_ack)
dcc_send_ack (dcc);
@@ -987,7 +992,7 @@ dcc_read_ack (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
if (len < 0)
{
- if (would_block_again ())
+ if (would_block ())
return TRUE;
}
EMIT_SIGNAL (XP_TE_DCCSENDFAIL, dcc->serv->front_session,
View
@@ -288,17 +288,9 @@ is_hilight (char *from, char *text, session *sess, server *serv)
SearchNick (text, prefs.irc_extra_hilight) ||
FromNick (from, prefs.irc_nick_hilight))
{
-#ifdef WIN32
if (sess != current_tab)
sess->nick_said = TRUE;
fe_set_hilight (sess);
-#else
- if (sess != current_tab)
- {
- sess->nick_said = TRUE;
- fe_set_hilight (sess);
- }
-#endif
return 1;
}
return 0;
View
@@ -16,8 +16,7 @@
#define closesocket close
#define set_blocking(sok) fcntl(sok, F_SETFL, 0)
#define set_nonblocking(sok) fcntl(sok, F_SETFL, O_NONBLOCK)
-#define would_block_again() (errno == EAGAIN || errno == EWOULDBLOCK)
-#define would_block() (errno == EWOULDBLOCK)
+#define would_block() (errno == EAGAIN || errno == EWOULDBLOCK)
#define sock_error() (errno)
#else
@@ -38,8 +37,6 @@
unsigned long one = 1; \
ioctlsocket (sok, FIONBIO, &one); \
}
-#define would_block_again() (WSAGetLastError() == WSAEWOULDBLOCK || \
- WSAGetLastError() == WSATRY_AGAIN)
#define would_block() (WSAGetLastError() == WSAEWOULDBLOCK)
#define sock_error WSAGetLastError
View
@@ -385,7 +385,7 @@ server_read (GIOChannel *source, GIOCondition condition, server *serv)
error = 0;
if (len < 0)
{
- if (would_block_again ())
+ if (would_block ())
return TRUE;
error = sock_error ();
}
View
@@ -464,6 +464,8 @@ fe_set_hilight (struct session *sess)
{
if (sess->gui->is_tab)
fe_set_tab_color (sess, 3, TRUE); /* blue, with taskbar flash */
+ else
+ fe_set_tab_color (sess, -1, TRUE); /* taskbar flash only */
}
static void
View
@@ -187,8 +187,7 @@ set_window_urgency (GtkWidget *win, gboolean set)
static void
flash_window (GtkWidget *win)
{
- if (!gtk_window_has_toplevel_focus (GTK_WINDOW (win)))
- set_window_urgency (win, TRUE);
+ set_window_urgency (win, TRUE);
}
static void
@@ -236,7 +235,7 @@ fe_set_tab_color (struct session *sess, int col, int flash)
}
#if defined(WIN32) || defined(USE_XLIB)
- if (flash && prefs.flash_hilight)
+ if (flash && prefs.flash_hilight && fe_gui_info (sess, 0) != 1)
flash_window (sess->gui->window);
#endif
}
@@ -827,6 +826,8 @@ mg_topdestroy_cb (GtkWidget *win, session *sess)
{
/* printf("enter mg_topdestroy. sess %p was destroyed\n", sess);*/
+ /* kill the text buffer */
+ gtk_xtext_buffer_free (sess->res->buffer);
/* kill the user list */
g_object_unref (G_OBJECT (sess->res->user_model));
@@ -975,9 +976,10 @@ mg_create_sess_tree (GtkWidget *menu)
}
static void
-mg_menu_destroy (GtkMenuShell *menushell, GtkWidget *menu)
+mg_menu_destroy (GtkWidget *menu, gpointer userdata)
{
gtk_widget_destroy (menu);
+ g_object_unref (menu);
}
static void
@@ -1139,8 +1141,12 @@ mg_tab_press_cb (GtkWidget *wid, GdkEventButton *event, session *sess)
if (sess && tabmenu_list)
menu_create (menu, tabmenu_list, sess->channel, FALSE);
+ if (event->window)
+ gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
+ g_object_ref (menu);
+ gtk_object_sink (GTK_OBJECT (menu));
g_signal_connect (G_OBJECT (menu), "selection-done",
- G_CALLBACK (mg_menu_destroy), menu);
+ G_CALLBACK (mg_menu_destroy), NULL);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, event->time);
return TRUE;
}
@@ -1462,6 +1468,8 @@ mg_link_irctab (session *sess, int focus)
mg_unpopulate (sess);
mg_changui_destroy (sess);
mg_changui_new (sess, sess->res, 1, focus);
+ /* the buffer is now attached to a different widget */
+ ((xtext_buffer *)sess->res->buffer)->xtext = (GtkXText *)sess->gui->xtext;
}
static void
View
@@ -161,7 +161,7 @@ userlist_button_cb (GtkWidget * button, char *cmd)
{
/* fake a selection */
nicks = malloc (sizeof (char *) * 2);
- nicks[0] = sess->channel;
+ nicks[0] = g_strdup (sess->channel);
nicks[1] = NULL;
num_sel = 1;
} else
@@ -203,9 +203,13 @@ userlist_button_cb (GtkWidget * button, char *cmd)
nick_command_parse (sess, cmd, nick, allnicks);
}
- if (nicks)
- free (nicks);
+ while (num_sel)
+ {
+ num_sel--;
+ g_free (nicks[num_sel]);
+ }
+ free (nicks);
free (allnicks);
}
@@ -439,9 +443,10 @@ menu_create (GtkWidget *menu, GSList *list, char *target, int check_path)
}
static void
-menu_destroy (GtkObject *object, gpointer objtounref)
+menu_destroy (GtkWidget *menu, gpointer objtounref)
{
- gtk_widget_destroy (GTK_WIDGET (object));
+ gtk_widget_destroy (menu);
+ g_object_unref (menu);
if (objtounref)
g_object_unref (G_OBJECT (objtounref));
}
@@ -454,13 +459,12 @@ menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
#endif
+ g_object_ref (menu);
+ gtk_object_sink (GTK_OBJECT (menu));
g_signal_connect (G_OBJECT (menu), "selection-done",
G_CALLBACK (menu_destroy), objtounref);
- if (event == NULL)
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, 0);
- else
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- 0, event->time);
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ 0, event ? event->time : 0);
}
static char *str_copy = 0; /* for all pop-up menus */
View
@@ -486,7 +486,10 @@ userlist_click_cb (GtkWidget *widget, GdkEventButton *event, gpointer userdata)
return TRUE;
}
if (nicks)
+ {
+ g_free (nicks[0]);
free (nicks);
+ }
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),

0 comments on commit e0374f9

Please sign in to comment.