1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Netbeans: crash when socket is disconnected unexpectedly.
12 Solution: Don't cleanup when a read fails, put a message in the queue and
13 disconnect later. (Xavier de Gaye)
17 *** ../vim-7.3.059/src/netbeans.c 2010-11-16 15:04:51.000000000 +0100
18 --- src/netbeans.c 2010-11-16 15:48:36.000000000 +0100
21 static int needupdate = 0;
22 static int inAtomic = 0;
25 ! netbeans_close(void)
30 - netbeans_send_disconnect();
33 if (inputHandler != (XtInputId)NULL)
36 static int needupdate = 0;
37 static int inAtomic = 0;
40 + * Close the socket and remove the input handlers.
43 ! nb_close_socket(void)
46 if (inputHandler != (XtInputId)NULL)
54 bevalServers &= ~BEVAL_NETBEANS;
72 + * Close the connection and cleanup.
73 + * May be called when nb_close_socket() was called earlier.
76 + netbeans_close(void)
80 + netbeans_send_disconnect();
85 bevalServers &= ~BEVAL_NETBEANS;
99 while (head.next != NULL && head.next != &head)
109 + #define DETACH_MSG "DETACH\n"
116 break; /* did read everything that's available */
121 ! /* read error or didn't read anything */
123 ! nbdebug(("messageFromNetbeans: Error in read() from socket\n"));
126 nbdebug(("read from Netbeans socket\n"));
127 PERROR(_("read from Netbeans socket"));
129 - return; /* don't try to parse it */
132 #if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK)
133 if (NB_HAS_GUI && gtk_main_level() > 0)
139 break; /* did read everything that's available */
142 + /* Reading a socket disconnection (readlen == 0), or a socket error. */
145 ! /* Queue a "DETACH" netbeans message in the command queue in order to
146 ! * terminate the netbeans session later. Do not end the session here
147 ! * directly as we may be running in the context of a call to
148 ! * netbeans_parse_messages():
149 ! * netbeans_parse_messages
150 ! * -> autocmd triggered while processing the netbeans cmd
152 ! * -> gui event loop or select loop
153 ! * -> netbeans_read()
155 ! save((char_u *)DETACH_MSG, strlen(DETACH_MSG));
160 nbdebug(("read from Netbeans socket\n"));
161 PERROR(_("read from Netbeans socket"));
165 #if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK)
166 if (NB_HAS_GUI && gtk_main_level() > 0)
175 nbdebug(("REP %d: <none>\n", cmdno));
177 + /* Avoid printing an annoying error message. */
178 + if (!NETBEANS_OPEN)
181 sprintf(reply, "%d\n", cmdno);
182 nb_send(reply, "nb_reply_nil");
188 # if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \
189 ! && !defined(FEAT_GUI_W32)
192 ! EMSG(_("E838: netbeans is not supported with this GUI"));
200 # if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \
201 ! && !defined(FEAT_GUI_W32)
204 ! EMSG(_("E838: netbeans is not supported with this GUI"));
209 *** ../vim-7.3.059/src/version.c 2010-11-16 15:04:51.000000000 +0100
210 --- src/version.c 2010-11-16 15:22:39.000000000 +0100
214 { /* Add new patch number below this line */
220 Another bucket of what can only be described as human ordure hits ARTHUR.
221 ARTHUR: ... Right! (to the KNIGHTS) That settles it!
222 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
224 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
225 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
226 \\\ an exciting new programming language -- http://www.Zimbu.org ///
227 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///