Closed Bug 232252 Opened 21 years ago Closed 16 years ago

open drafts discarded without prompt on shutdown

Categories

(Thunderbird :: Message Compose Window, defect)

x86
Windows XP
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: me, Unassigned)

References

Details

(Whiteboard: [fixed by bug 333907])

Attachments

(1 obsolete file)

User-Agent:       
Build Identifier: 

Thunderbird 0.7, Windows XP
Open Drafts do not prompt to save when windows is shutting down - modifications
are discarded

Reproducible: Didn't try
Steps to Reproduce:
1. edit a draft, don't save it
2. shut down and restart the computer
3. morn the loss of the edits to the draft



Expected Results:  
Propmted me to select 'save', 'discard', or 'cancel'; or, if it's an urgent
shutdown (ie battery dying), saved the window states and reloaded them on
relaunch of thunderbird
Shad Sterling, I am unable to reproduce this problem with TB 0.7, Win2K.
No response from reporter; =>WFM
Shad Sterling, feel free to reopen this, but please provide more information on 
reproducing this bug if you do.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
It still does this for me on both 0.9 and 1.0, WinXP SP2 (each version on a
different computer).  It doesn't save a draft which has never been saved, and it
doesn't save changes to a draft which has previously been saved.
It does prompt if I close the edit draft window, but not if the system closes it
during shutdown.
I have no idea what more infotmation there could be on how to reproduce it.
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
I cound reproduce same behavior using the latest thunderbird on Windows XP. When
I did shutdown with edit window open, thunderbird did not prompt me to save it
or not before being closed.

AFAIK, this issue is matter of handling WM_QUERYENDSESSION, WM_ENDSESSION. In
/toolkit/xre/nsNativeAppSupportWin.cpp (line 552), thunderbird seems to have a
routine to handle WM_QUERYENDSESSION message. However, I was not able to get
breakpoint hit for the routine. Also, when I sent the message to the main window
using adhoc script, spy++ log was showing that thunderbird just returned true.
(see http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/71073?help-en
for the script used)

<00001> 000B03FA S WM_QUERYENDSESSION nSource:0 (Logoff or Shutdown from Windows
Security dialog)
<00002> 000B03FA R WM_QUERYENDSESSION fShutdownIsOk:True
After spending few more hours, I got better understanding of this problem. First
of all, WM_QUERYENDSESSION message is received via 'ThunderbirdMessageWindow'
(in toolkit layer) and is handled inside of it. Thus, if you send fake message
to the window, you can get the breakpoint hit. If you take a look at the source
code, you will see that the window delegates the message handling to the
component which handles '-killAll' command line option. And the component is
implemented in nsKillAll.js with contract id 
'@mozilla.org/commandlinehandler/general-startup;1?type=killAll'. However, the
delegation does not work in thunderbird because that the compoment is missing in
thunderbird installation. Even if I registered the compoment manually, it still
did not work because that the compoment is not compatible with thunderbird.

I will udpate more information after doing researh on the compoment.
The component, nsKillAll.js, does not work with thunderbird because that server
mode is considered in the script and thunderbird(xre) does not support it. Once
I put try/catch block around server mode related code, it worked fine.

Please see http://www.mozilla.org/xpapps/MachVPlan/Turbo_Mode_Plan.html for
information on server mode. 
I got temporary solution to solve this issue.

1. download attached component (nsKillAllForTB.js) into thunderbird's component
directory( ex: C:\Program Files\Mozilla Thunderbird\components ). This component
is modified version of 'xpfe\components\killAll\nsKillAll.js'. I just took out
server mode related code from original version.
2. remove compreg.dat in thunderbird profile directory ( ex: C:\Documents and
Settings\jkim\Application Data\Thunderbird\Profiles\gctcg5xn.default). 
3. restart thunderbird.
4. If you log off during editing e-mail, thunderbird will give you a chance to
save it.
Thanks for tracking this down.  that patch works for me.
*** Bug 271064 has been marked as a duplicate of this bug. ***
Attachment #171073 - Attachment mime type: application/octet-stream → application/x-javascript
Attachment #171073 - Flags: review?(mscott)
Confirming this bug based on the detailed information from comment 4 onwards.
Jeongkyu Kim, is this patch still required in TB 1.5 or trunk?  Does the patch 
still apply?
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to comment #11)
> Confirming this bug based on the detailed information from comment 4 onwards.
> Jeongkyu Kim, is this patch still required in TB 1.5 or trunk?  Does the patch 
> still apply?

Unfortunately not. It appears to me that native windows support was moved from
xpfe to toolkit. And the killAll component from xpfe does not work in
thunderbird anymore. Thus toolkit needs to implement '-killAll' command line
option in its own way.

FYI, code to handle shutdown event(WM_QUERYENDSESSION) is here.
http://lxr.mozilla.org/seamonkey/source/toolkit/xre/nsNativeAppSupportWin.cpp#583

I am going to mark my patch as obsolete.

Jeongkyu
Attachment #171073 - Attachment is obsolete: true
Attachment #171073 - Flags: review?(mscott)
*** Bug 323981 has been marked as a duplicate of this bug. ***
Dupe of bug 333907?
Depends on: 333907
(In reply to comment #14)
> Dupe of bug 333907?
> 
It seems that your patch in bug 333907 will fix this problem.
QA Contact: message-compose
Assignee: mscott → nobody
Status: NEW → RESOLVED
Closed: 20 years ago16 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by bug 333907]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: