View Issue Details

IDProjectCategoryView StatusLast Update
0027743LazarusLCLpublic2020-03-31 13:47
ReporterRobert Rosendahl Assigned To 
Status newResolutionopen 
Product Version1.5 (SVN) 
Summary0027743: SIGSEGV when closing application while balloon hint of TTrayIcon is still visible
DescriptionI'm getting a SIGSEGV when closing my application while the balloon hint of a TTrayIcon is still showing. This seems to happen only when i compile in debug mode (on Windows 8.1 64bit). The debugger reports the SIGSEGV in include\ on line 541, that's the GetWindowLong call on the widget set:

Result := WidgetSet.GetWindowLong(Handle, int);

The problem disappears when i call TrayIcon1.Hide; in FormCloseQuery (or in DataModuleDestroy when working with a TDataModule).
Steps To ReproduceCompile the attachted test project in debug mode and run it. Clicking on "Show Balloon Hint" will show a balloon hint on the tray icon. Clicking on "Exit" while the balloon hint is still showing will produce the SIGSEGV.
Additional InformationForum discussion that led to this report:,27863.0.html
TagsNo tags attached.
Fixed in Revision
Attached Files


Robert Rosendahl

2015-03-27 23:40

reporter (3,675 bytes)

Zeljan Rikalo

2015-03-28 20:49

developer   ~0082403

I cannot reproduce it with trunk lazarus and fpc-2.6.4. Tested on linux qt,gtk2 and win32 under wine. Also tested under windows 7 (same binary, builded on linux). Works as expected.

Zeljan Rikalo

2015-04-02 17:20

developer   ~0082553

Cannot reproduce on XP 32bit.

Robert Rosendahl

2016-05-30 16:17

reporter   ~0092904

Oh dear, sorry for taking a year to respond! :-D Apparently my email preferences weren't set up to inform me on any feedback on the issue - i've changed that.

I've just downloaded and tried the example again and I still get a Segfault - but only when i compile and run it in debug mode (not in default mode). I'm using Windows 10 64-bit and the (stable) Lazarus 1.6 64-bit version.

Have you tried to change the project to "Debug" mode? Here's what i did: i opened the project, went to the project settings and switched to "Debug" mode. Then i recompiled (Ctrl+F9) and started it in the debugger (F9). Then, in the application window, i clicked the "Show Balloon Hint" button and then (while the hint was still visible) the "Exit" button. Then i got the SIGSEGV error (include\ line 541 - that seems to be: "Result := WidgetSet.GetWindowLong(Handle, int);").

jamie philbrook

2016-05-30 17:24

reporter   ~0092906

Last edited: 2016-05-30 22:42

View 2 revisions

Yes, I just got this using an older version of Laz (1.2.6)64 bit.

 To get it, you need to check mark the "HeapTrc" option in the Project options.

 without that checked, the problem does not show.

  To add a note to this case, in the past I have encountered issues with the
tray icon using API code before I had a written component for it, and I had
to ensure all associated windows attached to the icon code were not showing
or freed before pulling it off the tray.

  Maybe the simplest solution would be to hide the windows before destroy them so that windows can properly handle other icons and windows on the task bar.

  I tested on Windows 7 64

CudaText man

2018-05-28 18:32

reporter   ~0108563

maybe replace line
Result := WidgetSet.GetWindowLong(Handle, int);

if HandleAllocated then ...

or to
if Handle<>0 then ...

and I hope not needed "if Assigned(Widgetset) then..."?

Zeljan Rikalo

2020-03-31 13:42

developer   ~0121797

@CudaText man we cannot call if HandleAllocated there since there's no TWinControl as param, it should be called where wincontrol calls GetWindowLong.

Zeljan Rikalo

2020-03-31 13:47

developer   ~0121798

Removed myself from this issue. This is for some win32 specialist.

Issue History

Date Modified Username Field Change
2015-03-27 23:40 Robert Rosendahl New Issue
2015-03-27 23:40 Robert Rosendahl File Added:
2015-03-28 10:19 Zeljan Rikalo Assigned To => Zeljan Rikalo
2015-03-28 10:19 Zeljan Rikalo Status new => assigned
2015-03-28 20:49 Zeljan Rikalo LazTarget => -
2015-03-28 20:49 Zeljan Rikalo Note Added: 0082403
2015-03-28 20:49 Zeljan Rikalo Status assigned => feedback
2015-04-02 17:20 Zeljan Rikalo Note Added: 0082553
2016-05-30 16:17 Robert Rosendahl Note Added: 0092904
2016-05-30 16:17 Robert Rosendahl Status feedback => assigned
2016-05-30 17:24 jamie philbrook Note Added: 0092906
2016-05-30 22:42 jamie philbrook Note Edited: 0092906 View Revisions
2018-05-28 18:32 CudaText man Note Added: 0108563
2020-03-31 13:42 Zeljan Rikalo Note Added: 0121797
2020-03-31 13:47 Zeljan Rikalo Assigned To Zeljan Rikalo =>
2020-03-31 13:47 Zeljan Rikalo Status assigned => new
2020-03-31 13:47 Zeljan Rikalo Note Added: 0121798