1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-20 20:55:13 +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;} int32 func__screenhide(){return -screen_hide;}
void sub__consoletitle(qbs* s){ void sub__consoletitle(qbs* s){
if (new_error) return; #ifdef QB64_WINDOWS
static qbs *sz=NULL; if (!sz) sz=qbs_new(0,0); char *title;
static qbs *cz=NULL; if (!cz){cz=qbs_new(1,0); cz->chr[0]=0;} title = (char *)malloc(s->len + 1);
qbs_set(sz,qbs_add(s,cz)); title[s->len] = '\0'; //add NULL terminator
if (console){ if (console_active){ memcpy(title, s->chr, s->len);
#ifdef QB64_WINDOWS if (console){ if (console_active){
SetConsoleTitle((char*)sz->chr); SetConsoleTitle(title);
#endif }}
}} #endif
} }

View file

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