[haiku-development] Re: R5 Epson printer addon and _BMCItem_

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 08 Jul 2008 16:05:54 +0200

On 2008-07-07 at 18:21:57 [+0200], Julun <HOST.HAIKU@xxxxxx> wrote:
> 
> > The second one is a bit different, it happens when one is going to
> > create a epson printer. While calling unload_add_on(id) in the
> > print_server i get the crash with (see stack trace attached). What i
> > need here is some advice how to track that down or where to start
> > looking at. I already had a look a BLoopers Quit().
> > 
> 
> I prepared a patch that fixes the crash for me, but before I'm going to
> apply it I would like to ask to review it from some person that have a
> deeper knowledge of BLooper and BApplication.
> 
> What happened in unload_add_on was that Loopers::Quit was calling delete
> this and when returning from destructor calling exit_thread() which
> failed. After moving it into the destructor everything works as
> expected. I adjusted BApplication to take that into account. It seems
> also that BHandler's destructor is not executed in case fRunCalled is true.

Maybe I miss something obvious, but why would exit_thread() fail? And why 
would moving it to the destructor help in this case? I even think it is 
harmful to exit_thread() in the destructor, since neither will the BHandler 
destructor be invoked, nor will the memory for the object be freed.

Regarding BLooper::Run() moving the fMsgPort check up makes sense IMO, but I 
don't think moving "fRunCalled = true" before the thread has been created 
successfully does.

CU, Ingo

Other related posts: