[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Protect against negative size
From:       Vladimir Prus <ghost () cs ! msu ! su>
Date:       2007-12-11 5:58:23
Message-ID: fjl8tv$t0l$1 () ger ! gmane ! org
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic