View Issue Details

IDProjectCategoryView StatusLast Update
0012742LazarusIDEpublic2014-02-20 22:19
ReporterJoost van der Sluis Assigned ToVincent Snijders  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.27 (SVN) 
Target Version1.2.0Fixed in Version0.9.27 (SVN) 
Summary0012742: Lazarus on win64 ide-crash on opendialog showing the lazarus-source directory
DescriptionOn win64 Lazarus crashes if I open the file-dialog (open->file) and select the root of the lazarus-directory.
It takes a few seconds, then Lazarus just crashes. The debug-logs tells me that there's a second exception during the handling of the first exception. Running in GDB doesn't help. Stack seems corrupted
Additional InformationTMainIDE.ParseCmdLineOptions:
  PrimaryConfigPath="C:\Documents and Settings\joost\Local Settings\Application Data\lazarus"
  SecondaryConfigPath="C:\lazarus64"
NOTE: miscellaneous options file not found - using defaults
Opmerking: Configuratie bestand voor code tools niet gevonden - de standaard wordt gebruikt
NOTE: help options config file not found - using defaults
TMainIDE.DoLoadLFM A H:\tmp\utf8exceptionbug\unit1.pas IsPartOfProject=True
QuickCheckLFMBuffer LFMBuffer=H:\tmp\utf8exceptionbug\unit1.lfm
TJITComponentList.AddJITComponentFromStream.ReadStream Reading: FCurReadJITComponent=:TForm1 StreamClass=TForm1
TApplication.HandleException Access violation
  Stack trace:
  $0000000077C3CE2C
lazarus.pp - unhandled exception
Note: GetTextBuf is overridden for:
[FORMS.PP] ExceptionOccurred
  Sender=EAccessViolation
  Exception=Access violation
  Stack trace:
TApplication.HandleException: there was another exception during showing the first exception
  Stack trace:
  $000000000040D7AA
TagsNo tags attached.
Fixed in Revision
LazTarget1.2
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0010409 closedPaul Ishenin Lazarus OpenDialog.execute reliably crashes - OleInitialize not called for Windows executables 
related to 0013613 closedVincent Snijders Lazarus TSelectDirectoryDialog doesn't show directory tree since rev 19668 
related to 0024012 closedSergei Gorelkin FPC Enable Win64 SEH by default so exceptions in DLLs can properly be caught 
has duplicate 0024884 resolvedJuha Manninen Lazarus IDE crashes after "Project save as" and trying to create an new folder in the "Save as" dialog 
has duplicate 0025745 resolvedJuha Manninen Lazarus Can't open an existing project : IDE crash 
has duplicate 0027268 resolvedMaxim Ganetsky Lazarus IDE close 
related to 0021677 resolvedJuha Manninen Lazarus TFileNameEdit - Not compatible with 64 Bit 
related to 0023117 resolvedVincent Snijders Lazarus Crash after execute OpenDialog 
related to 0023449 resolvedJuha Manninen Lazarus Lazarus 1.0.4 32 bit crashes on selecting images for image list 
related to 0024626 closedMarco van de Voort FPC TOpenDialog.execute crashs with Runtime Error 217 if preview is enabled in Windows Explorer 
related to 0025067 closedMaxim Ganetsky Lazarus IDE crahes always when trying to open/save a File or a Project 

Activities

Vincent Snijders

2009-04-21 15:39

manager   ~0026892

I cannot reproduce this issue with current Lazarus on vista 64.

Does this problem still occur?

Joost van der Sluis

2009-04-23 19:21

manager   ~0026998

Yes, the problem is still there.

But I used win2k3 server, not Vista. (Initial report also was on this system)

Vincent Snijders

2009-04-27 11:27

manager   ~0027120

I will try to create win2k3 server in a virtual machine.

Vincent Snijders

2009-04-27 15:26

manager   ~0027130

Last edited: 2009-04-27 15:28

I installed lazarus compiled with fpc 2.2.4 on
Microsoft Windows Server 2003 R2
Standard x64 Edition
Service Pack 2.

I could not reproduce this issue.

Vincent Snijders

2009-04-28 21:56

manager   ~0027158

Please, close if ok.

Vincent Snijders

2009-05-04 15:42

manager   ~0027273

The fix has been reverted because of issue 0013613. Nowhere in the documentation is recommended to use COINIT_MULTITHREADED for gui applications, always OleInitialize or COINIT_APPTHREADED.

It is yet unclear why on this windows server 2003 the open dialog crashes in some directories.

Vincent Snijders

2009-05-24 13:08

manager   ~0027911

Postponed to 1.0, as it doesn't seem to be a regression, but I cannot find a solution.

The only thing I can think of is to create a new thread and use the FileOpenDialog in that thread. A lot of work and still unclear if it works at all.

Vincent Snijders

2011-10-07 20:18

manager   ~0052758

Can you still reproduce this with the latest version?

Tomasz Wieckowski

2011-11-28 12:44

reporter   ~0054521

I just get this (on Windows 7 64)

TApplication.HandleException Access violation
  Stack trace:
  $000000000995E100
TApplication.HandleException: there was another exception during showing the first exception
  Stack trace:
  $000007FEFE215B40
lazarus.pp - unhandled exception
[FORMS.PP] ExceptionOccurred
[FORMS.PP] ExceptionOccurred
[FORMS.PP] ExceptionOccurred
--------------------------------------------

This crash occur randomly and I think only when UseVistaDialogs is defined.
Crash occur when I click (single click) on folder in OpenDialog.
Several times my program written in Lazarus also crashed with OpenDialog but then windows has detected a system error in comdlg32.dll

I'll try to get more info.

Tomasz Wieckowski

2011-11-28 22:28

reporter   ~0054539

The problem is with VistaDialogs. Problem occurs at random folders or files. Sometimes just moving the mouse over the folders is enough to crash with delay of about 1 sec. Other apps don't have this problem, only lazarus.
I attach sample session - avi.

I think the crash is somewhere outside the program (ComDlg32/OLE),my knowledge is poor to find a problem.
I run app with WinDbg from "Debugging Tools for Windows (x64)" and this is part from crash (when click on folder):
ModLoad: 00000000`73a10000 00000000`73b96000 C:\PROGRA~1\COMMON~1\MICROS~1\OFFICE12\msoshext.dll
ModLoad: 00000000`72930000 00000000`729f9000 C:\Windows\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_88df89932faf0bf6\MSVCR80.dll
ModLoad: 00000000`6dde0000 00000000`6dfc2000 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\msxml5.dll
(cbc.b94): Unknown exception - code e0000002 (first chance)
(cbc.eac): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify timestamp for image00000000`00400000
*** ERROR: Module load completed but symbols could not be loaded for image00000000`00400000
image00000000_00400000+0x1f1ba8:
00000000`005f1ba8 50 push rax

2011-11-28 22:30

 

capture-1.rar (1,519,826 bytes)

Tomasz Wieckowski

2011-11-29 18:08

reporter   ~0054552

the problem is somewhere in the COM/OLE.
If I disable preview pane on Open Dialog Box and if I use a filter for not show files like doc,xls,... (which have an automatic preview) then there is no crash.
So it seems that the problem occurs when the system uses a COM on the dialog box to show preview.
Acording to my previous post, temporary I deleted msoshext.dll and no crash occurred (but preview still works) !?!?
I suspected a possible Threading Model for COM, but CoInitializeEx (nil, COINIT_MULTITHREADED) did not help.
BTW. Old Vista Dialogs also have problem when is set Large Icons (with preview).
So finllay step to reproduce:
(Win 7 64 + Office 2007) - click on MS Word document inside the NewFileOpenDialog with preview enabled.

Bart Broersma

2011-11-29 22:38

developer   ~0054555

I cannot reproduce this on Win7 (64 bit OS).
I have Office 2007 installed.
I have preview enabled in the opendialog (the new Vista kind).
Large Icons make no difference.
I can hoover over the filename and selecte (which opens the preview), tested with a word document and with an OpenOffice *.odt document.

Tomasz Wieckowski

2011-11-30 09:15

reporter   ~0054564

Can test several times by closing and opening the program? in different folders, sometimes for the first time it works ok. I tested on two systems.

Bart Broersma

2011-11-30 17:03

developer   ~0054574

Did you compile the program or 32 or 64 bit?

Tomasz Wieckowski

2011-11-30 18:54

reporter   ~0054576

> Did you compile the program or 32 or 64 bit?

32-bit works well,the crash occurs only with 64-bit lazarus.

Tomasz Wieckowski

2011-12-02 19:24

reporter   ~0054655

I tested on Office 2010 and works ok, so on the one hand it looks at the problem of office 2007 but on the other why it works ok with other apps and with lazarus 32 ?
And why whole apps crash when something goes wrong with preview on OpenFileDialog ?

I tried to find what is happening and I found CLSCTX_ACTIVATE_32_BIT_SERVER http://msdn.microsoft.com/en-us/library/windows/desktop/ms693716%28v=vs.85%29.aspx but lazarus doesn't have that flag for create FileOpenDialog object (CoCreateInstance).

Tomasz Wieckowski

2011-12-28 20:17

reporter   ~0055330

As Vincent said I checked with COINIT_MULTITHREADED (etc.) - no success.
I also checked in the simplest (no GUI):
-----------------------------------------
program project1;
uses
  Classes, Windows, ActiveX, ShlObj;
var
   Dialog: IFileOpenDialog;
   SWnd: HWND;
   title: string;

begin
  OleInitialize(nil);
  GetConsoleTitleA( PChar(title), 500 );
  SWnd:=FindWindowA( NIL, PChar(title) );
  if Succeeded(CoCreateInstance(CLSID_FileOpenDialog, nil, CLSCTX_INPROC_SERVER, IFileOpenDialog, Dialog)) and Assigned(Dialog) then
     begin
       Dialog._AddRef;
       Dialog.Show(SWnd);
     end;
  OleUninitialize;
end.
------------------------------------------
and also no success.

I checked VistaOpenDialog as GetOpenFileName from CommDlg (example code: http://www.dotfusion.net/vista-compatible-open-and-save-dialog-in-lazarus-freepascal)
and also with out success!!

Can be assumed that the problem is in communication between the OLE and the 64bit fpc program.
Office 2007 is always 32-bit but COM is 32/64. Don't know exactly how it looks but crash occur when Office Thumbnail/Preview Handler load msoshext.dll and assign whole preview stuff as threads to application process.

So if someone also would have this problem the only solution for me is to remove Office preview handler by remove this reg:

[HKEY_CLASSES_ROOT\CLSID\{C41662BB-1FA0-4CE0-8DC5-9B7F8279FF97}]
@="Microsoft Office Thumbnail Handler"

or you can use another 32-bit app. as a bridge to OpenDialog.

Zeljan Rikalo

2012-02-04 11:32

developer   ~0056332

Postponed because this could be fpc<->OLE related problem under win64 bit

Tomasz Wieckowski

2012-03-16 20:12

reporter   ~0057736

I've more info about this problem. Seems it's related with http://bugs.freepascal.org/view.php?id=10409

crash occur on OpenDialog ToolTips. When you disable Windows ToolTips everything is working properly.

Tomasz Wieckowski

2012-06-20 17:19

reporter   ~0060634

Last edited: 2012-06-20 17:21

Bug doesn't occur if using SEH support (-dTEST_WIN64_SEH for compiler) with fpc 2.7.1

as explained Sergei Gorelkin
www.mail-archive.com/fpc-devel@lists.freepascal.org/msg26229.html

this bug is probably related to the current (non-SEH) exception handling.

Vincent Snijders

2013-03-09 09:04

manager   ~0066144

Fixed in fpc 2.7.1

Issue History

Date Modified Username Field Change
2008-12-01 22:01 Joost van der Sluis New Issue
2008-12-01 22:01 Joost van der Sluis LazTarget => -
2008-12-01 22:01 Joost van der Sluis Widgetset => Win32
2008-12-07 21:04 Vincent Snijders LazTarget - => 0.9.28
2008-12-07 21:04 Vincent Snijders Status new => acknowledged
2008-12-07 21:04 Vincent Snijders Target Version => 0.9.28
2009-04-21 15:39 Vincent Snijders Note Added: 0026892
2009-04-21 15:39 Vincent Snijders Status acknowledged => feedback
2009-04-23 19:21 Joost van der Sluis Note Added: 0026998
2009-04-24 22:51 Vincent Snijders Status feedback => acknowledged
2009-04-27 11:27 Vincent Snijders Note Added: 0027120
2009-04-27 15:26 Vincent Snijders Note Added: 0027130
2009-04-27 15:28 Vincent Snijders Note Edited: 0027130
2009-04-28 20:42 Vincent Snijders Relationship added related to 0012409
2009-04-28 20:42 Vincent Snijders Relationship deleted related to 0012409
2009-04-28 20:42 Vincent Snijders Relationship added related to 0010409
2009-04-28 21:56 Vincent Snijders Fixed in Revision => 19668
2009-04-28 21:56 Vincent Snijders Status acknowledged => resolved
2009-04-28 21:56 Vincent Snijders Fixed in Version => 0.9.27 (SVN)
2009-04-28 21:56 Vincent Snijders Resolution open => fixed
2009-04-28 21:56 Vincent Snijders Assigned To => Vincent Snijders
2009-04-28 21:56 Vincent Snijders Note Added: 0027158
2009-04-30 13:07 Vincent Snijders Relationship added related to 0013613
2009-05-04 15:42 Vincent Snijders Status resolved => assigned
2009-05-04 15:42 Vincent Snijders Resolution fixed => reopened
2009-05-04 15:42 Vincent Snijders Note Added: 0027273
2009-05-24 13:08 Vincent Snijders LazTarget 0.9.28 => 1.0
2009-05-24 13:08 Vincent Snijders Note Added: 0027911
2009-05-24 13:08 Vincent Snijders Target Version 0.9.28 => 1.0.0
2009-07-07 09:12 Vincent Snijders Assigned To Vincent Snijders =>
2009-07-07 09:12 Vincent Snijders Status assigned => acknowledged
2011-10-07 20:18 Vincent Snijders Note Added: 0052758
2011-10-07 20:18 Vincent Snijders Status acknowledged => feedback
2011-11-28 12:44 Tomasz Wieckowski Note Added: 0054521
2011-11-28 22:28 Tomasz Wieckowski Note Added: 0054539
2011-11-28 22:30 Tomasz Wieckowski File Added: capture-1.rar
2011-11-29 18:08 Tomasz Wieckowski Note Added: 0054552
2011-11-29 22:38 Bart Broersma Note Added: 0054555
2011-11-30 09:15 Tomasz Wieckowski Note Added: 0054564
2011-11-30 17:03 Bart Broersma Note Added: 0054574
2011-11-30 18:54 Tomasz Wieckowski Note Added: 0054576
2011-12-02 19:24 Tomasz Wieckowski Note Added: 0054655
2011-12-28 20:17 Tomasz Wieckowski Note Added: 0055330
2012-02-04 11:32 Zeljan Rikalo LazTarget 1.0 => 1.2
2012-02-04 11:32 Zeljan Rikalo Note Added: 0056332
2012-02-04 16:07 Maxim Ganetsky Target Version 1.0.0 => 1.2.0
2012-03-16 20:12 Tomasz Wieckowski Note Added: 0057736
2012-04-08 13:41 Maxim Ganetsky Relationship added related to 0021677
2012-06-20 17:19 Tomasz Wieckowski Note Added: 0060634
2012-06-20 17:20 Tomasz Wieckowski Note Edited: 0060634
2012-06-20 17:21 Tomasz Wieckowski Note Edited: 0060634
2012-10-14 01:01 Juha Manninen Relationship added related to 0023117
2013-03-09 09:04 Vincent Snijders Relationship added related to 0024012
2013-03-09 09:04 Vincent Snijders Fixed in Revision 19668 =>
2013-03-09 09:04 Vincent Snijders Note Added: 0066144
2013-03-09 09:04 Vincent Snijders Status feedback => resolved
2013-03-09 09:05 Vincent Snijders Resolution reopened => fixed
2013-03-09 09:05 Vincent Snijders Assigned To => Vincent Snijders
2013-04-27 23:44 Juha Manninen Relationship added related to 0023449
2013-06-20 15:03 Vincent Snijders Relationship added related to 0024626
2013-09-28 19:23 Maxim Ganetsky Relationship added related to 0025067
2014-01-01 16:56 Juha Manninen Relationship added has duplicate 0024884
2014-02-20 22:19 Juha Manninen Relationship added has duplicate 0025745
2015-01-07 19:07 Maxim Ganetsky Relationship added has duplicate 0027268