Bugs item #912369, was opened at 2004-03-09 07:53 Message generated for change (Comment added) made by glutinous You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=428680&aid=912369&group_id=40696
Category: Behaviour Group: CVS Status: Open Resolution: None Priority: 5 Submitted By: Steven Wong (glutinous) Assigned to: Nobody/Anonymous (nobody) Summary: bbkeys causes failed assertion in libbt Initial Comment: Running bbkeys with blackbox. When ~/.bbkeysrc is modified or does not exist, bbkeys will exit due to a failed assertion. To reproduce, just run bbkeys without a config file, and wait around ten seconds. Or run bbkeys and add/or remove a few lines from your ~/.bbkeysrc. The assertion seems to be coming from a Font.cc, which exists in libbt, as far as I know. I'm running the current latest CVS versions of blackbox and bbkeys (2004-03-09). Here's the output from bug, produced by both the ways described above: $ bbkeys ScreenHandler: in findSupportingWM. ScreenHandler: first readSupportingWMCheck succeeded. ScreenHandler: second readSupportingWMCheck worked. ScreenHandler: Found compatible window manager: [Blackbox] for screen: [0]. ScreenHandler: Supported atoms: [45]. ScreenHandler: in findSupportingWM. ScreenHandler: first readSupportingWMCheck succeeded. ScreenHandler: second readSupportingWMCheck worked. ScreenHandler: Found compatible window manager: [Blackbox] for screen: [0]. ScreenHandler: Supported atoms: [45]. bbkeys: Font.cc:324: void bt::FontCache::release(const std::string&, unsigned int): Assertion `it != cache.end() && it->second.count > 0' failed. Aborted $ mv ~/.bbkeysrc ~/.bbkeysrc.old $ bbkeys KeyClient: ERROR: Couldn't load rc-file: [/home/steven/.bbkeysrc], falling back to default: [/home/steven/local/stow/bbkeys-cvs-2004-03-09/share/bbkeys/bbkeysrc] ScreenHandler: in findSupportingWM. ScreenHandler: first readSupportingWMCheck succeeded. ScreenHandler: second readSupportingWMCheck worked. ScreenHandler: Found compatible window manager: [Blackbox] for screen: [0]. ScreenHandler: Supported atoms: [45]. ScreenHandler: in findSupportingWM. ScreenHandler: first readSupportingWMCheck succeeded. ScreenHandler: second readSupportingWMCheck worked. ScreenHandler: Found compatible window manager: [Blackbox] for screen: [0]. ScreenHandler: Supported atoms: [45]. bbkeys: Font.cc:324: void bt::FontCache::release(const std::string&, unsigned int): Assertion `it != cache.end() && it->second.count > 0' failed. Aborted ---------------------------------------------------------------------- >Comment By: Steven Wong (glutinous) Date: 2004-06-17 00:21 Message: Logged In: YES user_id=987462 Looking at the bbkey assert problem (bug #912369), it would appear the Font and FontCache classes are a bit broken. I've made a small test program to reproduce the same problem BBKeys was exhibiting. After "fixing" this, bbkeys segfaults straight away now. :) I have an exam tomorrow, so I can't spend any more time one this. -_- Maybe I will look into it afterwards. But if someone could finish off what progress I've made, that would be great. Sorry to leave this half-finished. :) The patch is attached. It is output from: "cvs diff lib/Font.{cc,hh}". The program I used to test this is also attached. You will need SCons to compile it. It will be nice if we get a cppunit testing system going. :) CAUSE ===== Basically, this assertion fails when FontCache attempts to unload an empty-string fontname (ie., a font name of ""). Briefly summarising the steps leading to the assertion: 1. Make FontCache load an empty-string fontname. It will load the default font instead ("fixed"). 2. Tell FontCache to release the empty-string fontname... failed assertion occurs. FontCache only has a font called "fixed" in its cache, no font named "". SOLUTION ======== There are different ways to fix this. I think the cleanest is to add the following check in the bt::Font constructor: Font.hh: explicit Font(const std::string &name = std::string()); Font.cc: bt::Font::Font(const std::string &name) : _fontname(name), _fontset(0), _xftfont(0), _screen(~0u) { if (_fontname.empty()) _fontname = defaultFont; } I had to remove inline from the constructor, in order to get it to compile, which was unusual. I thought in-class function definitions were inline anyway, and that the inline keyword was for telling the compiler to inline functions that were not defined within the class declaration (that is, they were defined in the .cc, and not the .hh). (And what is up with all the inline warnings during compilation, anyway???) After this change, there is no need for the following line at the start of FontCache::findFontSet: if (fontsetname.empty()) return findFontSet(defaultFont); THE "NEW" SEGFAULT ================== This "new" segfault seems to occur in bt::FontCache::findFontSet. I suspect it's due to fontsetname referencing an invalid memory address, but I haven't fully checked this out yet. Backtrace from GDB: #0 bt::FontCache::findFontSet (this=0x9, [EMAIL PROTECTED]) at Font.cc:179 #1 0x08069ce1 in bt::Font::fontSet (this=0x80a5e40) at Font.cc:373 #2 0x08069d61 in bt::textHeight (screen=0, [EMAIL PROTECTED]) at Font.cc:420 #3 0x0807585f in bt::MenuStyle::load (this=0x80a5ce0, [EMAIL PROTECTED]) at Menu.cc:123 #4 0x0805c5a1 in ScreenHandler::initialize (this=0x80a5098) at ScreenHandler.cpp:133 #5 0x08050eb6 in KeyClient::initialize (this=0x8095c00) at KeyClient.cpp:137 #6 0x080506e4 in KeyClient (this=0x8095c00, argc=1, argv=0xbffff9e4, [EMAIL PROTECTED], display= {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x8095f00 "\020_\t\b\230d\t\b\001"}, static _S_empty_rep_storage = {0, 0, 11, 0}}) at KeyClient.cpp:105 #7 0x0805902e in main (argc=1, argv=0xbffff9e4) at main.cpp:103 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=428680&aid=912369&group_id=40696 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] List archives: http://asgardsrealm.net/lurker/splash/index.html Trouble? Contact [EMAIL PROTECTED]