#2070 closed Bug (Fixed)
_GUICtrlStatusBar_GetText() Crash
| Reported by: | TsukasaX | Owned by: | guinness |
|---|---|---|---|
| Milestone: | 3.3.9.1 | Component: | Standard UDFs |
| Version: | 3.3.7.21 | Severity: | None |
| Keywords: | Cc: |
Description
Func _Port()
Local $iPort = 0
Local $sPort = _SendQuiet('port')
If $iPort = 0 Then $iPort = _Regex($sPort, 'Port: ([\d]+)', 0)
Local $sIP = _GUICtrlStatusBar_GetText($hStatus, 0)
If StringRegExp($sIP, '(\:[\d]+)') = 1 Then
$sIP = StringRegExpReplace($sIP, '\:[\d]+', $iPort)
Else
$sIP &= ':' & $iPort
EndIf
_GUICtrlStatusBar_SetText($hStatus, $sIP, 0)
The idea of this code is to get the first part of a 4-part status bar that already has an IP address in it, determine if a port number is in it, and either update it or add it on then update the status bar.
Putting FileWriteLine()'s between commands shows the crash is indeed _GUICtrlStatusBar_GetText() as the FileWriteLine() one line after isn't reached. I tested some other _GUICtrlStatusBar functions and they worked one line before _GUICtrlStatusBar_GetText().
The crash is an ntdll.dll APPCRASH exception code c0000005.
I am unable to check to see if this issue has already been resolved because of no proper changelog.
Attachments (0)
Change History (12)
comment:1 by , 14 years ago
follow-up: 3 comment:2 by , 14 years ago
When you submit a test example, please make it "working".
Your one has no EndFunc neither an simulation of _SendQuiet(), _RegEx().
The worst is we cannot reproduce anything as we don't know on what $hStatus is coming from
Don't forget also to describe the environment you are running under as
Environment(Language:040C Keyboard:0000040C OS:WIN_7/Service Pack 1 CPU:X64 OS:X86)
We don't have cristal ball ...
comment:3 by , 14 years ago
Replying to Jpm:
When you submit a test example, please make it "working".
Your one has no EndFunc neither an simulation of _SendQuiet(), _RegEx().
The worst is we cannot reproduce anything as we don't know on what $hStatus is coming from
Don't forget also to describe the environment you are running under as
Environment(Language:040C Keyboard:0000040C OS:WIN_7/Service Pack 1 CPU:X64 OS:X86)
We don't have cristal ball ...
Also crashes at same line on 3.3.6.1 it seems.
The EndFunc was supposed to be the line after, sorry about that.
Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)
Here is the full source (without includes): <removed>, the line of interest is #252.
comment:5 by , 14 years ago
Thanks but your script cannot repro the pb.
Can you try to isolate the error as the "stream" stuff cannot run on any dev machine.
It is important to have the smallest repro script using basic window resource if possible.
Most of the time it is possible on real bug.
follow-up: 8 comment:6 by , 14 years ago
http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.
comment:7 by , 14 years ago
The problem is the text buffer is created too small. It needs to have room for a terminating null character, so in 3 different functions in that UDF it should read
If $fUnicode Then
$tText = DllStructCreate("wchar Text[" & $iBuffer + 1 & "]")
$iBuffer *= 2
Else
$tText = DllStructCreate("char Text[" & $iBuffer + 1 & "]")
EndIf
follow-up: 9 comment:8 by , 14 years ago
Replying to TsukasaX:
http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.
wraithdu is certainly true but on my system the crash does not occur ...
follow-up: 10 comment:9 by , 14 years ago
Replying to Jpm:
Replying to TsukasaX:
http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.
wraithdu is certainly true but on my system the crash does not occur ...
After manually changing the UDF to what wraithdu said, I did not get the crash even after multiple tests.
comment:10 by , 14 years ago
Replying to TsukasaX:
Replying to Jpm:
Replying to TsukasaX:
http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.
wraithdu is certainly true but on my system the crash does not occur ...
After manually changing the UDF to what wraithdu said, I did not get the crash even after multiple tests.
very good I hope somebody will commit it
comment:11 by , 14 years ago
| Milestone: | → 3.3.9.1 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [6787] in version: 3.3.9.1
comment:12 by , 14 years ago
| Component: | AutoIt → Standard UDFs |
|---|

Some of the functions may need some more explanation. _SendQuiet('port') should retrieve a string like "Port: 7000", and _Regex() would then retrieve the number with the "0" parameter being the default return value.