Re: Reoccuring problems

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Thu, 19 Dec 1996 23:09:39 +0100

Phil Boardman <phil@gi.net> said:

Phil> When I try to save the file, tkined crashes and creates/(or
Phil> wipes out) an empty file. It doesn't matter whether I make
Phil> any changes or not, or if I try to save it as a different
Phil> file, I get the same result. If you want, I could put the tki
Phil> file on an ftp site somewhere....let me know.

[Phil made the file available and I was able to reproduce the core.]

I think I have a fix which prevents the core dump. Your .tki file
causes tkined to creates an internal representation where you have a
link object which is not connected to any other objects. This causes a
core dump when writing a .tki file.

I do not yet understand how this link object is created (it should not
be possible to create such an object). Anyway, the patch below makes
sure that such an object is silently removed when saving a .tki file.

Juergen

*** tkined/generic/tkiEditor.c.orig Thu Oct 3 19:58:08 1996
--- tkined/generic/tkiEditor.c Thu Dec 19 22:31:32 1996
***************
*** 728,735 ****
Tki_Object *object;
Tcl_DString *dstp;
{
!
! if (object->done) return;

switch (object->type) {
case TKINED_NODE:
--- 732,738 ----
Tki_Object *object;
Tcl_DString *dstp;
{
! if (! object || object->done) return;

switch (object->type) {
case TKINED_NODE:
***************
*** 740,745 ****
--- 743,760 ----
break;
case TKINED_LINK:
{
+ if (! object->src) {
+ #if 0
+ fprintf(stderr, "*** link %s without src ***\n", object->name);
+ #endif
+ break;
+ }
+ if (! object->dst) {
+ #if 0
+ fprintf(stderr, "*** link %s without dst ***\n", object->name);
+ #endif
+ break;
+ }
do_dump (editor, interp, object->src, dstp);
do_dump (editor, interp, object->dst, dstp);
}