#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 in reply to: ↑ description Changed 13 years ago by TsukasaX
comment:2 follow-up: ↓ 3 Changed 13 years ago by 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 ...
comment:3 in reply to: ↑ 2 Changed 13 years ago by TsukasaX
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): http://pastebin.com/ATCzYsSS, the line of interest is #252.
comment:4 Changed 13 years ago by TsukasaX
Same line also crashes with 3.3.8.0
comment:5 Changed 13 years ago by Jpm
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.
comment:6 follow-up: ↓ 8 Changed 13 years ago by TsukasaX
http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.
comment:7 Changed 13 years ago by wraithdu
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
comment:8 in reply to: ↑ 6 ; follow-up: ↓ 9 Changed 13 years ago by 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 ...
comment:9 in reply to: ↑ 8 ; follow-up: ↓ 10 Changed 13 years ago by 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.
comment:10 in reply to: ↑ 9 Changed 13 years ago by Jpm
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 Changed 13 years ago by guinness
- Milestone set to 3.3.9.1
- Owner set to guinness
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [6787] in version: 3.3.9.1
comment:12 Changed 13 years ago by Jpm
- Component changed from AutoIt to Standard UDFs
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
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.