mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Fix crashing if you click back while update is still downloading, then go back to updates menu (Thanks 123DMWM)
This commit is contained in:
parent
0f862553ac
commit
22e3252b0e
@ -1609,16 +1609,24 @@ static void UpdatesScreen_Tick(struct LScreen* s_) {
|
||||
UpdatesScreen_CheckTick(s);
|
||||
}
|
||||
|
||||
/* Aborts fetch if it is in progress */
|
||||
static void UpdatesScreen_Free(struct LScreen* s_) {
|
||||
struct UpdatesScreen* s = (struct UpdatesScreen*)s_;
|
||||
s->BuildName = NULL;
|
||||
s->BuildProgress = -1;
|
||||
|
||||
FetchUpdateTask.Base.Working = false;
|
||||
s->LblStatus.Text.length = 0;
|
||||
}
|
||||
|
||||
struct LScreen* UpdatesScreen_MakeInstance(void) {
|
||||
struct UpdatesScreen* s = &UpdatesScreen_Instance;
|
||||
LScreen_Reset((struct LScreen*)s);
|
||||
s->Init = UpdatesScreen_Init;
|
||||
s->Draw = UpdatesScreen_Draw;
|
||||
s->Tick = UpdatesScreen_Tick;
|
||||
s->Free = UpdatesScreen_Free;
|
||||
s->Reposition = UpdatesScreen_Reposition;
|
||||
|
||||
s->BuildName = NULL;
|
||||
s->BuildProgress = -1;
|
||||
return (struct LScreen*)s;
|
||||
}
|
||||
#endif
|
||||
|
12
src/LWeb.c
12
src/LWeb.c
@ -531,10 +531,17 @@ void FetchUpdateTask_Run(bool release, bool d3d9) {
|
||||
const char* exe_ogl = "ClassiCube.unknown";
|
||||
#endif
|
||||
|
||||
const static String id = String_FromConst("CC update fetch");
|
||||
static char idBuffer[24];
|
||||
static int idCounter;
|
||||
String url; char urlBuffer[URL_MAX_SIZE];
|
||||
String_InitArray(url, urlBuffer);
|
||||
|
||||
String_InitArray(FetchUpdateTask.Base.Identifier, idBuffer);
|
||||
String_Format1(&FetchUpdateTask.Base.Identifier, "CC update fetch%i", &idCounter);
|
||||
/* User may click another update button in the updates menu before original update finished downloading */
|
||||
/* Hence must use a different ID for each update fetch, otherwise old update gets downloaded and applied */
|
||||
idCounter++;
|
||||
|
||||
String_Format2(&url, "http://cs.classicube.net/c_client/%c/%c",
|
||||
release ? "release" : "latest",
|
||||
d3d9 ? exe_d3d9 : exe_ogl);
|
||||
@ -543,8 +550,7 @@ void FetchUpdateTask_Run(bool release, bool d3d9) {
|
||||
LWebTask_Reset(&FetchUpdateTask.Base);
|
||||
FetchUpdateTask.Timestamp = release ? CheckUpdateTask.RelTimestamp : CheckUpdateTask.DevTimestamp;
|
||||
|
||||
FetchUpdateTask.Base.Identifier = id;
|
||||
Http_AsyncGetData(&url, false, &id);
|
||||
Http_AsyncGetData(&url, false, &FetchUpdateTask.Base.Identifier);
|
||||
FetchUpdateTask.Base.Handle = FetchUpdateTask_Handle;
|
||||
}
|
||||
|
||||
|
10
src/Window.c
10
src/Window.c
@ -711,7 +711,15 @@ void Window_EnableRawMouse(void) {
|
||||
rawMouseInited = true;
|
||||
}
|
||||
|
||||
void Window_UpdateRawMouse(void) { Window_CentreMousePosition(); }
|
||||
void Window_UpdateRawMouse(void) {
|
||||
if (rawMouseSupported) {
|
||||
/* handled in WM_INPUT messages */
|
||||
Window_CentreMousePosition();
|
||||
} else {
|
||||
Window_DefaultUpdateRawMouse();
|
||||
}
|
||||
}
|
||||
|
||||
void Window_DisableRawMouse(void) {
|
||||
rawMouseEnabled = false;
|
||||
Window_DefaultDisableRawMouse();
|
||||
|
Loading…
x
Reference in New Issue
Block a user