I've discovered that taskBarIconDelete crashes when you use it twice. I
first encountered this on Windows when I used it in the "on close"
attribute for removing the icon when I close the program.
I then tried to reproduce this on Linux and it first seemed to be a
Windows-only problem. But when I removed the "propagateEvent" on Linux I
couldn't close my program the first time, only the icon was deleted. The
second time I tried to close the program it segfaulted.
I first thought it correlated with the use of
evtHandlerOnTaskBarIconEvent, because removing this seemed to fix
everything. (maybe this is an uncorrelated, second, bug?)
But then I thought by myself: It doesn't make sense that the program
crashes on Linux on the second close attempt.
So wrote a minimal example to try out what happens when I delete the
taskbar-icon more than one time. And it segfaulted, like I expected. On
both, Linux and Windows.
When I delete in once, I can close my application afterwards
successfully. When I delete it twice, it segfaults.
Here are the environments I tested my program in:
* Windows XP using GHC 6.10.3 with wx-0.11.1.2 with wxWidgets-2.8.10
* Ubuntu 9.04 using GHC 6.10.3 with wx-0.11.1.2 with wxWidgets-220.127.116.11
This is the minimal example I've created to reproduce the bug, I also
attached it along with an icon:
module Main where
main :: IO ()
main = start example
example :: IO ()
example = do
icon <- iconCreateFromFile "example.ico" (sz 16 16)
tbicon <- taskBarIconCreate
f <- frame 
b <- button f [text := "delete taskbar icon", on command :=
taskBarIconSetIcon tbicon icon "example"
set f [layout := container f $ row 0 [widget b]]