#519 Crash when saving over open file

development
closed-fixed
TK Soh
Program (402)
7
2006-09-18
2006-03-29
Nathan Gray
No

Amazingly enough, I just saw two NEdit crashes in under
6 minutes after about a year of rock-solid stability!
This one should be reproducible:

0. NEdit configured to open files in tabs & sort tabs
1. touch a b c
2. nedit a b c
3. select c (or the rightmost tab)
4. file->save as, use "a" or "b" as the filename
5. warning that file exists
6. warning that file is already open
7. choose "close other window"

Now there is no tab selected, which is strange!

8. select a tab
9. select another tab
CRASH
On the console:
Error: Object "(null)" does not have windowed ancestor

NEdit release of Mar 3, 2005

Built on: MacOS X, PowerPC, GNU C
Built at: May 1 2005, 22:58:59
With Motif: 2.1.30 [@(#)Motif Version 2.1.30]
Running Motif: 2.1 [unknown]
Server: The XFree86 Project, Inc 40400000
Visual: 24-bit TrueColor (ID 0x22, Default)
Locale: C

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0xfeedface

Thread 0 Crashed:
0 libXt.6.dylib 0x9bb0b1c4 CallGetValuesHook + 72
1 libXt.6.dylib 0x9bb0b1fc CallGetValuesHook + 128
2 libXt.6.dylib 0x9bb0b1fc CallGetValuesHook + 128
3 libXt.6.dylib 0x9bb0b1fc CallGetValuesHook + 128
4 libXt.6.dylib 0x9bb0b568 XtGetValues + 444
5 libXt.6.dylib 0x9bb2fce8 XtVaGetValues + 524
6 nedit 0x00018da0 RefreshTabState + 48
(crt.c:355)
7 nedit 0x00019a94 RaiseDocument + 356
(crt.c:355)
8 nedit 0x0001aca0 raiseTabCB + 64 (crt.c:355)
9 libXt.6.dylib 0x9baf9bb8 XtCallCallbackList + 164
10 nedit 0x00087c54 SetActiveTab + 288
(crt.c:355)
11 nedit 0x00088820 PrimActivate + 32 (crt.c:355)
12 libXt.6.dylib 0x9baf9bb8 XtCallCallbackList + 164
13 nedit 0x000d07dc ActivateCommon + 248
(crt.c:355)
14 nedit 0x000d063c Activate + 36 (crt.c:355)
15 libXt.6.dylib 0x9bb2c188 HandleActions + 264
16 libXt.6.dylib 0x9bb2cc4c HandleComplexState + 416
17 libXt.6.dylib 0x9bb2cd30 _XtTranslateEvent + 164
18 libXt.6.dylib 0x9bb06b9c XtDispatchEventToWidget + 860
19 libXt.6.dylib 0x9bb0756c _XtDefaultDispatcher + 680
20 libXt.6.dylib 0x9bb077b0 XtDispatchEvent + 400
21 nedit 0x000626a4 ServerDispatchEvent + 204
(crt.c:355)
22 nedit 0x00062530 ServerMainLoop + 40
(crt.c:355)
23 nedit 0x00003834 main + 2840 (crt.c:355)
24 nedit 0x00002568 _start + 348 (crt.c:272)
25 nedit 0x00002408 start + 60

Thread 0 crashed with PPC Thread State 64:
srr0: 0x000000009bb0b1c4 srr1: 0x000000000000d030
vrsave: 0x0000000000000000
cr: 0x24044422 xer: 0x0000000020000006
lr: 0x000000009bb0b184 ctr: 0x000000009b76893c
r0: 0x000000009bb0b1fc r1: 0x00000000bfffd1e0
r2: 0x00000000abafb184 r3: 0x00000000feedface
r4: 0x00000000005eef60 r5: 0x00000000005ea790
r6: 0x0000000000000001 r7: 0x0000000000000001
r8: 0x00000000ab768620 r9: 0x00000000005f3c00
r10: 0x00000000ffffffff r11: 0x0000000001801825
r12: 0x0000000000000000 r13: 0x00000000ffffffff
r14: 0x0000000000000001 r15: 0x0000000000000000
r16: 0x0000000000000000 r17: 0x00000000a0001b98
r18: 0x0000000000000000 r19: 0x00000000001b0d08
r20: 0x0000000000c001a3 r21: 0x000000000180b800
r22: 0x0000000000000002 r23: 0x00000000abafb3b8
r24: 0x00000000abafb3b8 r25: 0x00000000005ea790
r26: 0x00000000005eef60 r27: 0x00000000feedface
r28: 0x00000000abaf7590 r29: 0x00000000abaf7594
r30: 0x00000000feedface r31: 0x000000009bb0b184

Discussion

  • TK Soh

    TK Soh - 2006-03-29

    Logged In: YES
    user_id=411637

    Can you confirm if you see this with 5.5? I tried post-5.5
    dev versions on Solaris and Redhat 9, but unable to recreate
    your bug.

     
  • Nathan Gray

    Nathan Gray - 2006-03-29

    Logged In: YES
    user_id=121553

    I just reproduced it with CVS head. I don't know if it
    matters, but are you sure alphabetical tab sorting is enabled?

     
  • TK Soh

    TK Soh - 2006-03-29

    Logged In: YES
    user_id=411637

    I can see the crash now. I think I know where the problem
    might be. I'll need some time to work this out though.

     
  • TK Soh

    TK Soh - 2006-03-30

    Logged In: YES
    user_id=411637

    Some tabs were in the process of being destroyed when the
    sortting took place. Please try the following patch.

    BTW, is it safe to access core.being_destroyed on other
    platforms? It seemed okay on Solaris, HPUX 11i and Redhat.

    diff -r 113ea85417bc source/window.c
    --- a/source/window.c Fri Mar 17 06:20:34 2006 +0000
    +++ b/source/window.c Thu Mar 30 08:26:10 2006 +0800
    @@ -866,7 +866,7 @@ void SortTabBar(WindowInfo *window)
    WindowInfo *w;
    WindowInfo **windows;
    WidgetList tabList;
    - int i, nDoc;
    + int i, j, nDoc, tabCount;

    if (!GetPrefSortTabs())
    return;
    @@ -885,17 +885,20 @@ void SortTabBar(WindowInfo *window)
    qsort(windows, nDoc, sizeof(WindowInfo *),
    compareWindowNames);

    /* assign tabs to documents in sorted order */
    - XtVaGetValues(window->tabBar, XmNtabWidgetList,
    &tabList, NULL);
    - for (i=0; i<nDoc; i++) {
    - if (windows[i]->tab == tabList[i])
    - continue;
    -
    - /* set tab as active */
    - if (IsTopDocument(windows[i]))
    + XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
    + XmNtabCount, &tabCount, NULL);
    +
    + for (i=0, j=0; i<tabCount && j<nDoc; i++) {
    + if (tabList[i]->core.being_destroyed)
    + continue;
    +
    + /* set tab as active */
    + if (IsTopDocument(windows[j]))
    XmLFolderSetActiveTab(window->tabBar, i, False);
    -
    - windows[i]->tab = tabList[i];
    - RefreshTabState(windows[i]);
    +
    + windows[j]->tab = tabList[i];
    + RefreshTabState(windows[j]);
    + j++;
    }

    XtFree((char *)windows);

     
  • Thorsten Haude

    Thorsten Haude - 2006-08-11
    • assigned_to: nobody --> tksoh
     
  • Thorsten Haude

    Thorsten Haude - 2006-08-11

    Logged In: YES
    user_id=119143

    So is this fixed?

     
  • Thorsten Haude

    Thorsten Haude - 2006-09-17

    Logged In: YES
    user_id=119143

    Is this fixed?

     
  • Nathan Gray

    Nathan Gray - 2006-09-18

    Logged In: YES
    user_id=121553

    Changes by: n8gray@sc8-pr-cvs1.sourceforge.net.(none) 06/04/
    10 23:29:43

    Modified files:
    nedit/source/: window.c

    Log message:
    Since I'm on a roll, this is TK's fix for SF bug
    1460456: Crash when saving over
    open file.

     
  • Nathan Gray

    Nathan Gray - 2006-09-18
    • status: open --> closed-fixed
     

Log in to post a comment.