From kwrite-devel Tue Dec 11 05:58:23 2007 From: Vladimir Prus Date: Tue, 11 Dec 2007 05:58:23 +0000 To: kwrite-devel Subject: Re: Protect against negative size Message-Id: X-MARC-Message: https://marc.info/?l=kwrite-devel&m=119735314511469 Joseph Wenninger wrote: > On Monday 10 December 2007 12:31:33 Thomas Friedrichsmeier wrote: >> On Sunday 09 December 2007, Vladimir Prus wrote: >> > Now, I don't know what's right solution for this problem. >> > On KDevelop side, I'm gonna make sure KateView is never 0 in height. >> > However, I'd like propose the following patch that merely adds >> > assert -- so that next time somebody runs into this problem, the >> > crash is more obvious. >> >> Ah, thanks for tracking this down. I ran into the same issue with one of >> the kateparts in RKWard, but I had a workaround, and never investigated. >> Testing shows it is indeed this same negative height issue. >> >> Would it be ok to simply add a qMax(1, ...) around the calculation of the >> new cache size, to make sure it is always at least 1? >> > > I think, if it doesn't have any bad sideeffects (other crashes, memleaks) > this is a better idea than the assert, which still terminates the hosting > application. In fact, I've also tried the similar solution -- which uses 0 instead of height if the height is start with, and that did fix the KDevelop crash. However, it's about the first time I actually looked at Kate code, so I had no clue if this solution is likely to crash later. If you think it causes no problems, then clearly it's better than plain assert. Thanks! - Volodya _______________________________________________ KWrite-Devel mailing list KWrite-Devel@kde.org https://mail.kde.org/mailman/listinfo/kwrite-devel