Page 1 of 1

issue-#202 drag & pick across BlackBox instances traps

Posted: Tue Sep 03, 2019 8:19 pm
by Josef Templ
A rather serious bug was reported to me. It causes a trap that sometimes crashes BlackBox. Seems to destroy the memory integrity of the system.

For the issue see https://redmine.blackboxframework.org/issues/202.

- Josef

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Wed Sep 04, 2019 12:40 am
by luowy
this issue caused by illeagal memeory access, track to HostWindows.Directory.GetThisWindow,
the patch is simple(on windows):

Code: Select all

VAR mpid:INTEGER;
...
PROCEDURE (dir: Directory) GetThisWindow* ( 
	..VAR wpid:INTEGER;
BEGIN
   ...
	wnd := WinApi.WindowFromPoint(pt); res:=WinApi.GetWindowThreadProcessId(wnd,wpid);
	IF (wnd # 0)&(wpid = mpid) THEN
	...
END GetThisWindow;
...
PROCEDURE Init;
....
res:=WinApi.GetWindowThreadProcessId(main,mpid);
END;

luowy

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Thu Sep 05, 2019 7:33 pm
by Josef Templ
This does not work for me.

drag & pick is now disabled at all.

- Josef

P.S. I will be on vacation the next 2 weeks and only occasionally on the internet.

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Fri Sep 06, 2019 11:07 am
by luowy
i test it ok:
1, drag&drop selected text to another bb instance window worked as before;
2,holding the alt key and drap the selected text on another instance bb window is forbidden, no trap window anymore

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Fri Sep 06, 2019 11:15 am
by Robert
Drag & pick (between instances) being not allowed seems better than having it crash.

I don't think that not being able to drag & pick between instances is a serious limitation.

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Wed Sep 18, 2019 5:14 am
by Josef Templ
It has been reported to me that if the line in Init is appended to CreateMainWindows then it works.

- Josef

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Sun Sep 22, 2019 6:54 pm
by Josef Templ
I have committed the fix to the issue branch.

For the changes see https://redmine.blackboxframework.org/p ... 44565bf663.

The fix is as proposed by luowy except that mpid initialization is done in CreateMainWindows, not in Init.
@luowy: please check.

- Josef

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Mon Sep 23, 2019 4:44 am
by luowy
ok! The change is more reasonable.

Re: issue-#202 drag & pick across BlackBox instances traps

Posted: Wed Sep 25, 2019 4:43 pm
by Josef Templ
There seems to be no problem with the fix.
So I would like to propose to continue with the voting.

- Josef