WebView: fixed critical memory leak

git-svn-id: svn://kolibrios.org@8339 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-08 11:26:22 +00:00
parent 4c90768ccb
commit f7bbca99e7
6 changed files with 20 additions and 36 deletions

View File

@ -464,7 +464,7 @@ void TWebBrowser::SetStyle() {
EDI = EAX;
img.w.add(ESDWORD[EDI+4]);
img.h.add(ESDWORD[EDI+8]);
free(EDI);
img_destroy stdcall(EDI);
img.url.add(#img_path);

View File

@ -29,40 +29,24 @@ void _img::add(dword _path, _x, _y, _w, _h)
h.add(_h);
}
/*
void _img::draw_all(int _x, _y, _w, _h, _start)
{
int i, img_y;
for (i=0; i<url.count; i++)
{
img_y = y.get(i);
if (img_y + h.get(i) > _start) && (img_y - _h < _start)
&& (cache.has(url.get(i))) draw(_x, _y, _w, _h, _start, i);
}
}
*/
bool _img::draw(int _x, _y, _w, _h, _start, i)
{
int img_x, img_y, img_w, img_h, invisible_h=0;
char* img_ptr;
img_x = x.get(i);
img_y = y.get(i);
img_w = math.min(w.get(i), _w - img_x);
img_h = math.min(h.get(i), _h + _start - img_y);
if (_start > img_y) {
invisible_h = _start - img_y;
img_y = _start;
}
img_decode stdcall (cache.current_buf, cache.current_size, 0);
if (EAX) {
EDI = EAX;
img_x = x.get(i);
img_y = y.get(i);
img_w = math.min(w.set(i, ESDWORD[EDI+4]), _w - img_x);
img_h = math.min(h.set(i, ESDWORD[EDI+8]), _h + _start - img_y);
if (_start > img_y) {
invisible_h = _start - img_y;
img_y = _start;
}
img_draw stdcall(EDI, img_x + _x, img_y - _start + _y, img_w, img_h - invisible_h, 0, invisible_h);
free(EDI);
}
img_ptr = EAX;
img_draw stdcall(img_ptr, img_x + _x, img_y - _start + _y, img_w, img_h - invisible_h, 0, invisible_h);
img_destroy stdcall(img_ptr);
}

View File

@ -42,7 +42,7 @@
// DATA //
// //
//===================================================//
char version[]="WebView 2.8 BETA";
char version[]="WebView 2.8 BETA 2";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE

View File

@ -43,6 +43,8 @@ bool _cache::has(dword _link)
void _cache::clear()
{
int i;
for (i=0; i<data.count; i++) free(data.get(i));
url.drop();
data.drop();
size.drop();

View File

@ -181,8 +181,6 @@ void MonitorProgress()
if (exit_param) ExitProcess();
StopDownloading();
DrawWindow();
http.hfree();
}
}

View File

@ -116,7 +116,7 @@ void main()
if (!http.receive_result) {
CreateFile(http.content_received,
http.content_pointer, "/tmp0/1/latest.img");
http.hfree();
http.stop();
EventDownloadComplete();
}
}