]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.060
- new
[packages/vim.git] / 7.3.060
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.060
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.060
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)
14 Files:      src/netbeans.c
15
16
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
19 ***************
20 *** 135,148 ****
21   static int needupdate = 0;
22   static int inAtomic = 0;
23   
24       static void
25 ! netbeans_close(void)
26   {
27 -     if (!NETBEANS_OPEN)
28 -       return;
29
30 -     netbeans_send_disconnect();
31
32   #ifdef FEAT_GUI_X11
33       if (inputHandler != (XtInputId)NULL)
34       {
35 --- 135,146 ----
36   static int needupdate = 0;
37   static int inAtomic = 0;
38   
39 + /*
40 +  * Close the socket and remove the input handlers.
41 +  */
42       static void
43 ! nb_close_socket(void)
44   {
45   #ifdef FEAT_GUI_X11
46       if (inputHandler != (XtInputId)NULL)
47       {
48 ***************
49 *** 167,179 ****
50   # endif
51   #endif
52   
53   #ifdef FEAT_BEVAL
54       bevalServers &= ~BEVAL_NETBEANS;
55   #endif
56   
57 -     sock_close(nbsock);
58 -     nbsock = -1;
59
60       needupdate = 0;
61       inAtomic = 0;
62       nb_free();
63 --- 165,191 ----
64   # endif
65   #endif
66   
67 +     sock_close(nbsock);
68 +     nbsock = -1;
69 + }
70
71 + /*
72 +  * Close the connection and cleanup.
73 +  * May be called when nb_close_socket() was called earlier.
74 +  */
75 +     static void
76 + netbeans_close(void)
77 + {
78 +     if (NETBEANS_OPEN)
79 +     {
80 +       netbeans_send_disconnect();
81 +       nb_close_socket();
82 +     }
83
84   #ifdef FEAT_BEVAL
85       bevalServers &= ~BEVAL_NETBEANS;
86   #endif
87   
88       needupdate = 0;
89       inAtomic = 0;
90       nb_free();
91 ***************
92 *** 632,640 ****
93       char_u    *p;
94       queue_T   *node;
95   
96 -     if (!NETBEANS_OPEN)
97 -       return;
98
99       while (head.next != NULL && head.next != &head)
100       {
101         node = head.next;
102 --- 644,649 ----
103 ***************
104 *** 720,725 ****
105 --- 729,736 ----
106   }
107   #endif
108   
109 + #define DETACH_MSG "DETACH\n"
110
111       void
112   netbeans_read()
113   {
114 ***************
115 *** 780,801 ****
116             break;      /* did read everything that's available */
117       }
118   
119       if (readlen <= 0)
120       {
121 !       /* read error or didn't read anything */
122 !       netbeans_close();
123 !       nbdebug(("messageFromNetbeans: Error in read() from socket\n"));
124         if (len < 0)
125         {
126             nbdebug(("read from Netbeans socket\n"));
127             PERROR(_("read from Netbeans socket"));
128         }
129 -       return; /* don't try to parse it */
130       }
131   
132   #if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK)
133       if (NB_HAS_GUI && gtk_main_level() > 0)
134 !         gtk_main_quit();
135   #endif
136   }
137   
138 --- 791,822 ----
139             break;      /* did read everything that's available */
140       }
141   
142 +     /* Reading a socket disconnection (readlen == 0), or a socket error. */
143       if (readlen <= 0)
144       {
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
151 !        *              -> ui_breakcheck
152 !        *                  -> gui event loop or select loop
153 !        *                      -> netbeans_read()
154 !        */
155 !       save((char_u *)DETACH_MSG, strlen(DETACH_MSG));
156 !       nb_close_socket();
157
158         if (len < 0)
159         {
160             nbdebug(("read from Netbeans socket\n"));
161             PERROR(_("read from Netbeans socket"));
162         }
163       }
164   
165   #if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK)
166       if (NB_HAS_GUI && gtk_main_level() > 0)
167 !       gtk_main_quit();
168   #endif
169   }
170   
171 ***************
172 *** 1164,1169 ****
173 --- 1185,1194 ----
174   
175       nbdebug(("REP %d: <none>\n", cmdno));
176   
177 +     /* Avoid printing an annoying error message. */
178 +     if (!NETBEANS_OPEN)
179 +       return;
180
181       sprintf(reply, "%d\n", cmdno);
182       nb_send(reply, "nb_reply_nil");
183   }
184 ***************
185 *** 2753,2763 ****
186   {
187   #ifdef FEAT_GUI
188   # if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK)  \
189 !                 && !defined(FEAT_GUI_W32)
190       if (gui.in_use)
191       {
192 !         EMSG(_("E838: netbeans is not supported with this GUI"));
193 !         return;
194       }
195   # endif
196   #endif
197 --- 2778,2788 ----
198   {
199   #ifdef FEAT_GUI
200   # if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK)  \
201 !               && !defined(FEAT_GUI_W32)
202       if (gui.in_use)
203       {
204 !       EMSG(_("E838: netbeans is not supported with this GUI"));
205 !       return;
206       }
207   # endif
208   #endif
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
211 ***************
212 *** 716,717 ****
213 --- 716,719 ----
214   {   /* Add new patch number below this line */
215 + /**/
216 +     60,
217   /**/
218
219 -- 
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
223
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    ///
This page took 0.048125 seconds and 3 git commands to generate.