lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV DIRED-related bug fix


From: kweide
Subject: LYNX-DEV DIRED-related bug fix
Date: Thu, 27 Mar 1997 23:24:08 -0700

Glenn Nielsen wrote in 
<http://www.flora.org/lynx-dev/html/month0397/msg00654.html>:

>          LYNX-DEV lynx2.7 BUG REPORT: DIRED null pointer problem

>     * Subject: LYNX-DEV lynx2.7 BUG REPORT: DIRED null pointer problem
>     * From: Glenn Nielsen <address@hidden>
>     * Date: Thu, 20 Mar 1997 15:25:26 -0600
>   
>LYNX2.7 running on a sparc with solaris 2.5
>
>   There appear to be a number of problems with null pointers
>when using DIRED in an empty directory.  The function dired_options()
>in LYLocal.c will pass a null pointer for path_url to render_item()
>which does no checks for null pointers when you try to use F)ull menu
>for DIRED in an empty directory.  I fixed this by applying this patch:

[ snipped patch - kw ]

That patch is now in Fote's bugfixes, (and also the devel code).

>But even with this patch there continue to be other problems
>when trying to create a new file in an empty directory, then
>remove it.  Lynx doesn't update its internal links for the new file,
>so unless you go back up to the parent directory you can't remove the
>new file.  And while trying to do something with this new empty file
>I was able to get lynx to crash several more times.  Although
>these instances haven't been easily repeatable.  If I have time I'll
>try to track down these other problems and forward a patch to you.

I could reproduce those, and think the appended patch is the right fix
to prevent the invalid memory access.  It is already in the developing
code available through <URL:http://www.slcc.edu/lynx/klaus/merged/all/>.
I have also made some other, related changes to LYLocal.c (and lynx.cfg)
in the development code (which are not given in this mail).  Here are the
relevant entries from CHANGES.new:

1997-03-27
* In mainloop(), after the call to HText_pageDisplay() following a change
  of the document view, ensure that curdoc.link does not remain set to -1 
  if there are any links on the screen.  This would otherwise happen if
  a document is pushed to the history stack while there are no links, and
  later popped (and refreshed) after one or more links have been created.
  This change prevents segmentation faults which occurred after creation
  of a new file in a previously empty directory via the DIRED menu.  The
  access to invalid memory only occurred if the screen showing the empty
  directory did not have a parent dir reference link (which is always the
  case if NO_PARENT_DIR_REFERENCE was specified at compiliation time). - KW
* In LYLocal.c, modified the code handling DIRED_MENU to do more careful
  checking of the selected file.  In addition to "TAG", "FILE", and "DIR", 
  DIRED_MENU definitions in lynx.cfg now also recognize LINK as a type.
  DIRED_MENU definitions with a type field of "LINK" are only used if the
  current selection is a symbolic link ("FILE" and "DIR" definitions are
  not used in that case).  The default menu definitions have been updated
  to reflect this change, and to avoid the showing of menu items whose
  action would always fail - KW

   Klaus

*** /usr/ns-home/docs/lynx/fote/lynx2-7/src/LYMainLoop.c        Thu Mar 27 
13:13:55 1997
--- lynx2-7/src/LYMainLoop.c    Thu Mar 27 22:58:47 1997
***************
*** 869,874 ****
--- 869,879 ----
                curdoc.link = newdoc.link;
                if (curdoc.link >= nlinks)
                    curdoc.link = nlinks - 1;
+               /* We may have popped a doc (possibly in local_dired)
+                  which didn't have any links when it was pushed, but
+                  does have links now (e.g. a file was created) - kw */
+               else if (curdoc.link < 0 && nlinks > 0)
+                   curdoc.link = 0;
            }
  
            show_help = FALSE; /* reset */
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]