Issue #21: Caret blink freezed

Post Reply
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Issue #21: Caret blink freezed

Post by luowy »

problem:
if you do not power down your computer or restart it up to 49.7days ,you will find the the caret of BB editor frozen, not blinking at all.

reason:
the Controllers.TickMsg.tick get value from WinApi.GetTickCount() which will be overflow after 49.7days after the machine start up,then the TextControllers.BlinkCaret cant do a correct check, the blink of caret will not blink.

My Patch:


1,Controllers

Code: Select all

   TickMsg* = RECORD (Message) 
         tick*: LONGINT(*INTEGER*)   (** IN **)
   END;
2,HostWindows.Idle

Code: Select all

     IF w.frame # NIL THEN
         tick.tick := Services.Ticks();(*WinApi.GetTickCount();*)
         w.ForwardCtrlMsg(tick)
      END;
3,
TextControllers.BlinkCaret

Code: Select all

      PROCEDURE BlinkCaret (c: StdCtrl; f: Views.Frame; tick: LONGINT(*INTEGER*));
compile these modules:

Code: Select all

^Q DevCompiler.CompileThis Controllers Containers Documents HostWindows TextControllers

I have not authorized to access the new issue page,just post a discussion at here.

luowy
Last edited by luowy on Fri Dec 12, 2014 3:48 pm, edited 1 time in total.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Issue #21: Caret blink freezed

Post by Ivan Denisov »

I added issue:
http://redmine.blackboxframework.org/issues/21
Also added Luowy to developers of project for him can create issues by him self like other Center members who are registered in Redmine.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Issue #21: Caret blink freezed

Post by Ivan Denisov »

Ivan Denisov wrote:I agree with Doug because of "Caret blink" bug we have only one month to prepare new release!
http://forum.blackboxframework.org/view ... f=40&t=152

After this date 1.6 final will not work well.
I understand now, that this bug do not force us to make release! Sorry If I had confused somebody by mail. I did not fully understand the issue.

Nevertheless, I suggest to vote for including this bug fix in Center version.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue #21: Caret blink freezed

Post by Josef Templ »

I agree, the bug fix should be included. The bug fix by luowy looks very reasonable to me.
Ivan or luowy, if you like, go ahead and create topic branch issue-#21 in GitHub for this bug.
Add the fixes as proposed by luowy and ALSO add the fixes in the docu file
for Controllers (see TickMsg, the type has been changed from INTEGER to LONGINT).
It is a trivial change in the docu but it should be included.

Please don't forget to add the "Refs. #21." phrase in the commit message.

Then we can vote for merging it to master.
Same procedure as always.
I am more than happy if I don't have to do all the editing myself because I am pretty busy right now.

In the redmine issue #21:
The wording should be improved from:
if you do not power down your computer or restart it up to 49.7days ,you will find the the caret of BB editor will be freezed,not blink at all.
to:
if you do not power down your computer or restart it up to 49.7days, you will find the caret of the BB editor frozen, not blinking at all.

I cannot do this correction. May be only the original author or an Administrator can do it.

- Josef
cfbsoftware
Posts: 204
Joined: Wed Sep 18, 2013 10:06 pm
Contact:

Re: Issue #21: Caret blink freezed

Post by cfbsoftware »

Microsoft's recommendation to fix this problem is to use the GetTickCount64 Windows API function instead of GetTickCount:

http://msdn.microsoft.com/en-us/library ... s.85).aspx

Luowy's proposed solution to use Services.Ticks could still be used if preferred but I recommend that the Kernel.Time function that Services.Ticks calls should also be modified to call GetTickCount64 instead of GetTickCount. The workaround that is currently implemented in Kernel.Time to cater for the wraparound after 49.7 days could then be eliminated. Kernel.Time is currently:

Code: Select all

PROCEDURE Time* (): LONGINT;
		VAR t: INTEGER;
	BEGIN
		t := WinApi.GetTickCount();
		IF t < told THEN INC(shift) END;
		told := t;
		RETURN shift * 100000000L + t
	END Time;
This could be simplified to:

Code: Select all

PROCEDURE Time* (): LONGINT;
	BEGIN
		RETURN WinApi.GetTickCount64();
	END Time;
and the related globals told and shift could be eliminated.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue #21: Caret blink freezed

Post by Josef Templ »

the 'changes' list in the header of the affected files has not been updated so far.

- 20141213, center #21, Fixing Controllers.TickMsg.tick overflow bug.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Issue #21: Caret blink freezed

Post by Ivan Denisov »

Josef Templ wrote:the 'changes' list in the header of the affected files has not been updated so far.

- 20141213, center #21, Fixing Controllers.TickMsg.tick overflow bug.

- Josef
Fixed this before merging with master.

The resulting version is: http://blackboxframework.org/unstable/m ... a1.034.zip
Post Reply