1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 08:51:22 +00:00

Fixes race condition between vWatch and _CONSOLETITLE

It was a love triangle with _WindowHandle in the end, it's complicated.
This commit is contained in:
FellippeHeitor 2021-08-18 00:21:03 -03:00
parent f9c35a57d3
commit 744bd19107
2 changed files with 15 additions and 13 deletions

View file

@ -26203,15 +26203,15 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int32 func__screenhide(){return -screen_hide;}
void sub__consoletitle(qbs* s){
if (new_error) return;
static qbs *sz=NULL; if (!sz) sz=qbs_new(0,0);
static qbs *cz=NULL; if (!cz){cz=qbs_new(1,0); cz->chr[0]=0;}
qbs_set(sz,qbs_add(s,cz));
if (console){ if (console_active){
#ifdef QB64_WINDOWS
SetConsoleTitle((char*)sz->chr);
#endif
}}
#ifdef QB64_WINDOWS
char *title;
title = (char *)malloc(s->len + 1);
title[s->len] = '\0'; //add NULL terminator
memcpy(title, s->chr, s->len);
if (console){ if (console_active){
SetConsoleTitle(title);
}}
#endif
}

View file

@ -97,10 +97,12 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
LOOP
END IF
IF vw_hwndsent = 0 AND _WINDOWHANDLE > 0 THEN
vw_hwndsent = -1
vw_cmd$ = "hwnd:" + _MK$(_OFFSET, _WINDOWHANDLE)
GOSUB SendCommand
IF vw_hwndsent = 0 THEN
IF _WINDOWHANDLE > 0 THEN
vw_hwndsent = -1
vw_cmd$ = "hwnd:" + _MK$(_OFFSET, _WINDOWHANDLE)
GOSUB SendCommand
END IF
END IF
IF vwatch_linenumber = 0 THEN