[TextEditor_mcc] Re: Editor test program crashes in MorphOS

  • From: Ilkka Lehtoranta <ilkleht@xxxxxxxxxxx>
  • To: texteditor_mcc@xxxxxxxxxxxxx
  • Date: Tue, 16 Aug 2005 17:42:12 +0300 (EEST)

On Thu, 11 Aug 2005, Jens Langner wrote:

> Hi Ilkka,
> 
> Ilkka Lehtoranta schrieb:
> 
> > Got problem mentioned in the title - test program was hitting like crazy 
> > and busylooped. Dumped binary from hitzone and it was good old 
> > LineCharsWidth() again.
> [...]
> > There is one problem left: the temporary rastport is initialized in 
> > MUIM_Setup and MUIM_Hide. It seems (at least in MUI4) that MUIM_Setup is 
> > not invoked at all if object is in window but hidden.
> 
> Either this is a MUI4 specific thing (which I can't believe) or the
> reason must be something different because it is very unwise that
> MUIM_Setup is not called even if the object is hidden in the window.
> That's because in our current (and also probably in other mcc's as well)
> the whole configuration initialization is done in MUIM_Setup.

You are right, MUIM_Setup is called.

> > It is also possible to crash editor if text is inserted right after when 
> > application object is created. Temporary rastport should be initialized in 
> > OM_NEW already. I dont know what to use for SetFont() ?  
> > GfxBase->DefaultFont ?
> 
> As I said. Normally (since the very first version of MUI) MUIM_Setup is
> always called no matter if the object is hidden or not and it also
> doesn't make much sense why it shouldn't be called. For such a purpose
> you normally have MUIM_Show and MUIM_Hide AFAIK. And no, setting the
> font to DefaultFont is not the proper way of doing it. The only sensible
> solution (in case MUI4 is really not calling MUIM_Setup and it is also
> no bug in MUI4) would be to move the InitConfig() call to OM_NEW as well
> and then do a SetFont(data->font) accordingly.
> 
> So please do invesitgate a bit further because I can't really believe
> that Stefan changed MUI so fundamentally because then many other MUI
> calsses would probably not work anymore.

I made furhter experiments with texteditor-test and there is something 
strange going on. I added some simple debug output:

Varasto:Lähdekoodit/cvs/texteditor/mcc> bin_mos/TextEditor-Test.debug  
OM_NEW
show window
MUIM_Setup
MUIM_Show
VisualHeight(), data->shown is 0, data->tmprp.Font is 0x00000000
VisualHeight(), data->shown is 0, data->tmprp.Font is 0x00000000

 [snipped]

VisualHeight(), data->shown is 0, data->tmprp.Font is 0x00000000
VisualHeight(), data->shown is 0, data->tmprp.Font is 0x00000000
MUIM_Hide
MUIM_Cleanup
Varasto:Lähdekoodit/cvs/texteditor/mcc>


Culprit is found: there is NULL font pointer in the rastport.

I guess rastport init in MUIM_Show should be moved above VisualHeight() 
calls?

But what if user calls InsertText and other functions before setting 
MUIA_Window_Open to TRUE? There would be this 'no font set' problem still.


  Ilkka

_____________________________________________________________________________
TextEditor ML   - http://www.freelists.org/list/texteditor_mcc
Listserver help - mailto:texteditor_mcc-request@xxxxxxxxxxxxx?Subject=HELP
Bugtracker......: http://sourceforge.net/tracker/?atid=731469&group_id=135025

Other related posts: