[qwaq] Use full file path for file search

Fixes the memory leak (over 300 editors...)
This commit is contained in:
Bill Currie 2020-07-04 01:36:46 +09:00
parent 225ee0ed3c
commit 1914fa2756

View file

@ -53,6 +53,7 @@
-(Editor *) find_file:(string) filename -(Editor *) find_file:(string) filename
{ {
Editor *file; Editor *file;
filename = qdb_get_file_path (target, filename);
for (int i = [files count]; i-- > 0; ) { for (int i = [files count]; i-- > 0; ) {
file = [files objectAtIndex: i]; file = [files objectAtIndex: i];
if ([file filename] == filename) { if ([file filename] == filename) {
@ -62,8 +63,7 @@
Rect rect = {{1, 1}, [source_window size]}; Rect rect = {{1, 1}, [source_window size]};
rect.extent.width -= 2; rect.extent.width -= 2;
rect.extent.height -= 2; rect.extent.height -= 2;
string filepath = qdb_get_file_path (target, filename); file = [Editor withRect:rect file:filename];
file = [Editor withRect:rect file:filepath];
[files addObject: file]; [files addObject: file];
return file; return file;
} }