mirror of git://git.sv.gnu.org/nano.git
startup: don't call delwin() with NULL, to avoid crashing on Solaris
Apparently the curses on SunOS is less forgiving than the one on GNU. Or rather: delwin(NULL) should just return an error, it shouldn't crash. This fixes https://savannah.gnu.org/bugs/?51053. Reported-by: John Wiersba <jrw32982@yahoo.com> Solved-by: John Wiersba <jrw32982@yahoo.com>
This commit is contained in:
parent
e4775c2060
commit
9ce41543ed
|
@ -95,14 +95,14 @@ char *present_path = NULL;
|
|||
|
||||
unsigned flags[4] = {0, 0, 0, 0};
|
||||
/* Our flag containing the states of all global options. */
|
||||
WINDOW *topwin;
|
||||
WINDOW *topwin = NULL;
|
||||
/* The top portion of the window, where we display the version
|
||||
* number of nano, the name of the current file, and whether the
|
||||
* current file has been modified. */
|
||||
WINDOW *edit;
|
||||
WINDOW *edit = NULL;
|
||||
/* The middle portion of the window, i.e. the edit window, where
|
||||
* we display the current file we're editing. */
|
||||
WINDOW *bottomwin;
|
||||
WINDOW *bottomwin = NULL;
|
||||
/* The bottom portion of the window, where we display statusbar
|
||||
* messages, the statusbar prompt, and a list of shortcuts. */
|
||||
int editwinrows = 0;
|
||||
|
@ -1728,6 +1728,7 @@ int strtomenu(const char *input)
|
|||
* function unless debugging is turned on. */
|
||||
void thanks_for_all_the_fish(void)
|
||||
{
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
|
|
|
@ -677,14 +677,17 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
|
|||
/* Initialize the three window portions nano uses. */
|
||||
void window_init(void)
|
||||
{
|
||||
/* First delete existing windows, in case of resizing. */
|
||||
/* When resizing, first delete the existing windows. */
|
||||
if (edit != NULL) {
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
topwin = NULL;
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
}
|
||||
|
||||
/* If the terminal is very flat, don't set up a titlebar. */
|
||||
if (LINES < 3) {
|
||||
topwin = NULL;
|
||||
editwinrows = 1;
|
||||
/* Set up two subwindows. If the terminal is just one line,
|
||||
* edit window and statusbar window will cover each other. */
|
||||
|
|
Loading…
Reference in New Issue