[Eric] segfault using Plugin_Assistant_Eric-snapshot

Dan Bullok dan.eric at bullok.com
Sat Aug 2 00:52:06 BST 2008


Hi Detlev.

I've tracked down the problem in AssistantEric.

The following code appears in DbAPIsWorker.__storeApis:
	lexer = QScintilla.Lexers.getLexer(language)
Apparently, the lexer object returned uses QFont somewhere, because when the 
above code executes, I get the warning:
	QFont: It is not safe to use text and fonts outside the GUI thread
when using a debug build of Qt 4.3.4.

The solution is simple, if a bit inelegant. 
__storeApis only uses lexer to get its autoCompletionWordSeparators(), so we 
just need to get these in the main GUI thread, instead of within the 
DbAPIsWorker thread.  The attached patch stores the ac word separators for 
all supported languages in the constructor for DbAPIsWorker.  __storeApis 
then just looks up the word separators when needed.

A couple of lines down from the above line, there is the line:
	lexer = self.__proxy.getLexer()
Which will have the same problem of accessing a GUI object outside the GUI 
thread.  It's never executed on my machine, so it's probably for some unusual 
case (when __storeApis is called with language = None).  I covered this case 
by adding an autoCompletionWordSeparators() method to the DbAPIs class, which 
as far as I can tell, is the only class ever used as __proxy.  I haven't 
tested this part of the patch, so if you know how to get that part of the 
code to run, it should be tested.

This appears to have fixed the segfault problem I was having.  At least, it 
hasn't happened after a few hours of using Eric today.

-Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plugin_Assistant_Eric-snapshot-20080726--QFont-segfault-fix.patch
Type: text/x-diff
Size: 2222 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/eric/attachments/20080802/7b257b0e/Plugin_Assistant_Eric-snapshot-20080726--QFont-segfault-fix.bin


More information about the Eric mailing list