On Sat, Jun 07, 2008 at 06:04:07PM +0200, Johannes Hofmann wrote:
On Thu, Jun 05, 2008 at 10:43:36PM +0000, corvid wrote:
Johannes wrote:
On Thu, Jun 05, 2008 at 06:05:39PM +0000, corvid wrote:
I've seen occasional segfaults in recent weeks, and twice now I've been able to catch them when I remembered to have gdb going (and, well, zero times when I remembered to have ulimit -c unlimited)
I had some of these segfaults too.
These two have been nearly identical. Here's the one I just got:
#0 0x00000048 in ?? () #1 0x080aa74e in dw::core::Layout::removeFont (this=0x815ca58, attrs=0x81dfc08) at layout.hh:253 #2 0x080a8f07 in dw::core::style::Font::remove (this=0x81dfc08, layout=0x815ca58) at style.cc:287 #3 0x080aa85a in dw::core::style::Font::unref (this=0x81dfc08, layout=0x815ca58) at style.hh:587 #4 0x080aa042 in ~Style (this=0x81d8680) at style.cc:204 #5 0x0805b123 in dw::core::style::Style::unref (this=0x81d8680) at style.hh:505 #6 0x08089359 in ~Textblock (this=0x8249308) at textblock.cc:96 #7 0x080a52e7 in dw::core::Layout::setWidget (this=0x822f868, widget=0x827b3b0) at layout.cc:175 #8 0x0805aea8 in a_Web_dispatch_by_type ( Type=0x827c480 "text/html; charset=UTF-8", Web=0x824ebc0, Call=0x821d320, Data=0x821d324) at web.cc:94 [snip] My guess at the problem: StyleTable will give you back whatever Style matches your attrs, but maybe that Style was created with a different layout.
I will have a look at that. Maybe the StyleTable should be associated with a layout too.
It looks like style uses layout to get to platform. I wonder whether it would go against any dw rules to let style have platform.
My problem is that I don't understand why fontsTable and colorsTable need to be platform specific in the first place. As long as their members match they should be sharable - even if they are used for different platforms.
I would just make them static members of Font and Color respectively. That way we would no longer need the layout parameter in the *::create methods.
To make clear what I mean, here comes the patch: http://www.ecademix.com/JohannesHofmann/tmp/layoutless_style.dw2 http://www.ecademix.com/JohannesHofmann/tmp/layoutless_style.dillo2 (they are too large for the list). I'm not sure why Sebastian avoided that possiblity. Maybe the virtual destructors which are needed in this implementation? Comments welcome! I feel a bit uncomfortable proposing a pretty drastic change like this. Cheers, Johannes