issue-#202 drag & pick across BlackBox instances traps

Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#202 drag & pick across BlackBox instances traps

Post 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
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

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

Post 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
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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.
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

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

Post 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
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

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

Post 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.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post by Josef Templ »

It has been reported to me that if the line in Init is appended to CreateMainWindows then it works.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

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

Post by luowy »

ok! The change is more reasonable.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post by Josef Templ »

There seems to be no problem with the fix.
So I would like to propose to continue with the voting.

- Josef
Post Reply