Windows Vista Wrong Thread on Close

Archives Forums/BlitzPlus Bug Reports/Windows Vista Wrong Thread on Close

Kcarlino(Posted 2008) [#1]
When using the System menu Close or the X icon (in the upper right) on Windows Vista an error dialog errors reporting simply "Wrong Thread".

Best Regards,

Ken Carlino

Kcarlino(Posted 2009) [#2]
Is there any news for a possible fix or work around for this issue?

Best Regards,

Ken Carlino

ozzi789(Posted 2009) [#3]

I got the same Problem and it is quite iritating
the update to 1.46 didnt help :(

plz is there any solution?

ozzi789(Posted 2009) [#4]
sry for the pushing, but somehow id like an awnser :'(

anybody any idea?
plz help

CloseToPerfect(Posted 2009) [#5]
can you post a small code example of this? I don't seem to have the problem, unless I just don't understand what you are talking about.

GaryV(Posted 2009) [#6]
I don't have B+, but are you sure you are handling the exit/close message properly?

ozzi789(Posted 2009) [#7]
When checking a $803 (windows closed by X button) and its true, the window does close but sometimes you get an Error "Wrong Thread"

I think something is messed up with the window handles, so it doesnt know which client windows were created(by blitz), something like that

Kcarlino(Posted 2009) [#8]
Here is the simplest code that always fails for on 2 different Vista systems that I personal test with.

window=CreateWindow( "Graphics window",0,0,640,480 )
While WaitEvent(0)
If EventID()=$803 End

Some additional information.

- The 2 systems that I test on where I've seen this happen on are both Vista 64 systems.
- Multiple users of my software have reported seeing this error on my application.
- The problem occurs when running from within BlitzBasic or from a compiled application, BUT, when running in debug mode within BlitzBasic the error does not occur.

Please let me know if you need additional tests performed it would be very helpful to have this issue addressed.

Ken Carlino

GaryV(Posted 2009) [#9]
Were the users with the issue also running Vista 64?

Since you are mentioning Vista 64 and Blitz Plus does not produce 64bit EXEs, I am guessing there is some conflict going on with the 32bit emulation layer that Vista 64 is using.

Kcarlino(Posted 2009) [#10]
Unfortunately I didn't ask about the Vista version when this was reported since at that time I didn't have a reason to think that it could be related to that.

Most likely obvious....but the Wrong Thread error occurs after the BlitzPlus End function is called.

Ken Carlino

GaryV(Posted 2009) [#11]
That is a shame, that is a crucial piece of info. If an EU reports a bug, getting the version of the OS should be mandatory.

Based on what is described, I am guessing they were using Vista 64bit, and there is some niggling issue that Mark needs to look at. Maybe he will have a chance to look at it after he finished up with the latest Max release? B+ does have a lot of life left in it and would be worth his effort.

Dreamora(Posted 2009) [#12]
On Vista64 the error happens for sure.
But the 64bit is no excuse for it, because BlitzPlus is the only application that shows that. Not even the other Blitz languages have that problem so its clearly a problem with the thread ending code for B+ killing the wrong thread (first?) on close

Kcarlino(Posted 2009) [#13]
Forcibly killing the process with the Windows API ExitProcess function results in this error message not occurring. I guess this could result in some resources not properly closed or freed.

Anyone have further thoughts on a possible work around.


GaryV(Posted 2009) [#14]
An official comment (one way or the other) from Mark, would be nice.

ozzi789(Posted 2009) [#15]
Jep it was a 64bit Vista
and it only appears when the debugger is off

"B+ does have a lot of life left in it and would be worth his effort. "
true words ..

GaryV(Posted 2009) [#16]
Mark, any comment?

GaryV(Posted 2009) [#17]
I have been helping test this for one of the guys since I have a plethora of machines and configurations at work.

So far this has happened on 6 different Vista64 machines I have tried it on.

ozzi789(Posted 2009) [#18]
10 Months without a Comment from Marks side

il guess i will just compile my new Project with the debugger on -_-*

GaryV(Posted 2009) [#19]
It might be time to start looking at a competing language since BlitzPlus does not work properly on Vista 64.

ozzi789(Posted 2009) [#20]
Maybe i should start to learn BlitzMax, but i dont want to learn it if after 2 Years its not getting developed/supported anymore..

GaryV(Posted 2009) [#21]
ozzi789: If the bug hasn't been fixed 10 months after being reported, it probably isn't going to get fixed. Time to move on.

Kcarlino(Posted 2009) [#22]
For what it's worth I've gone with using the Windows API ExitProcess and so far have not found any problems with doing this.


blackgecko(Posted 2009) [#23]
The "Wrong Thread" Error also appears on Windows 7 RC (also 64 bit). I think it's because of the "End"-Command. If I use this
window=CreateWindow( "Graphics window",0,0,640,480 )
 If EventID()=$803 Exit

it works fine.

GaryV(Posted 2009) [#24]
Does that work without error for when the "X" is clicked and for ending the program?

ozzi789(Posted 2009) [#25]
config_file=OpenFile ("config.ini")   
   WriteLine (config_file,GadgetX(win))
   WriteLine (config_file,GadgetY(win))
   WriteLine (config_file,1)

If lcd=1	
  G15_FreeFont sm8
  G15_FreeFont sm6
  G15_FreeFont sm12

This is the code on a 803 in my project, the wrong thread still comes when i use Exit instead of End!

Could you please post me the decls for that ExitProcess?
thnx :)

ok ExitProcess works fine!

just copy

.lib "kernel32.dll"
api_ExitProcess (uExitCode%) : "ExitProcess"

into a decls file and use

api_ExitProcess (uExitCode%) not End ;)

sswift(Posted 2009) [#26]
I had someone report this bug with my texture generator as well today.

GaryV(Posted 2009) [#27]
any official word?

marksibly(Posted 2009) [#28]

We're looking into it right now.

ozzi789(Posted 2009) [#29]
Cool it got fixed with 1.47!

Thanks helps me pretty much :)