summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-02-22 19:32:37 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-02-22 19:32:37 +0000
commit24d0c49ae447a1c2184ed500390561cbcf00f0bb (patch)
tree168907fc6233a676427394b3eab15a35ea4bef75
parent559b651669b17ed8015cefc0e25a4ff52f9cdb45 (diff)
downloadweechat-24d0c49ae447a1c2184ed500390561cbcf00f0bb.zip
Fixed crash when quitting WeeChat
-rw-r--r--src/gui/gui-common.c8
-rw-r--r--src/irc/irc-server.c4
-rw-r--r--weechat/src/gui/gui-common.c8
-rw-r--r--weechat/src/irc/irc-server.c4
4 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index f64d79bea..633d4acf1 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -337,7 +337,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
void
gui_window_free (t_gui_window *window)
{
- if (window->buffer->num_displayed > 0)
+ if (window->buffer && (window->buffer->num_displayed > 0))
window->buffer->num_displayed--;
/* remove window from windows list */
@@ -458,6 +458,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
if (last_gui_buffer == buffer)
last_gui_buffer = buffer->prev_buffer;
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ {
+ if (ptr_win->buffer == buffer)
+ ptr_win->buffer = NULL;
+ }
+
free (buffer);
/* always at least one buffer */
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 3bb93686d..6587c08d1 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -949,6 +949,10 @@ server_disconnect (t_irc_server *server, int reconnect)
{
t_irc_channel *ptr_channel;
+ /* not connected/connecting to server */
+ if (!server->is_connected && (server->child_pid == 0))
+ return;
+
if (server->is_connected)
{
/* write disconnection message on each channel/private buffer */
diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c
index f64d79bea..633d4acf1 100644
--- a/weechat/src/gui/gui-common.c
+++ b/weechat/src/gui/gui-common.c
@@ -337,7 +337,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
void
gui_window_free (t_gui_window *window)
{
- if (window->buffer->num_displayed > 0)
+ if (window->buffer && (window->buffer->num_displayed > 0))
window->buffer->num_displayed--;
/* remove window from windows list */
@@ -458,6 +458,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
if (last_gui_buffer == buffer)
last_gui_buffer = buffer->prev_buffer;
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ {
+ if (ptr_win->buffer == buffer)
+ ptr_win->buffer = NULL;
+ }
+
free (buffer);
/* always at least one buffer */
diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c
index 3bb93686d..6587c08d1 100644
--- a/weechat/src/irc/irc-server.c
+++ b/weechat/src/irc/irc-server.c
@@ -949,6 +949,10 @@ server_disconnect (t_irc_server *server, int reconnect)
{
t_irc_channel *ptr_channel;
+ /* not connected/connecting to server */
+ if (!server->is_connected && (server->child_pid == 0))
+ return;
+
if (server->is_connected)
{
/* write disconnection message on each channel/private buffer */