[TextEditor_mcc] Re: Editor test program crashes in MorphOS

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

On Tue, 16 Aug 2005, Jens Langner wrote:

> > Culprit is found: there is NULL font pointer in the rastport.
> > 
> > I guess rastport init in MUIM_Show should be moved above VisualHeight() 
> > calls?
> This _might_ fix the problem. But there is still the open question now
> that you have checked that MUIM_Setup is called, why tmprp.Font is NULL.
> Because if you look at our MUIM_Setup implementation then you should
> perfectly spot the initialization part right after the SuggestWindow() call:
> -- cut here --
>     if(SuggestWindow(data))
>     {
>       DoMethod(_app(obj), OM_ADDMEMBER, data->SuggestWindow);
>       // initialize our temporary rastport
>       InitRastPort(&data->tmprp);
>       SetFont(&data->tmprp, data->font);
> [...]
> -- cut here --
> so here you can see that I already added a proper initialization to the
> MUIM_Setup method of TextEditor. The question is now why later on
> data->tmprp.Font is NULL? Because it shouldn't be null in MUIM_Show
> cause MUIM_Setup sets up the font for the temporary rastport already
> because MUIM_Show is called.

Okay. data->tmprp.Font is NULL because data->font is NULL at MUIM_Setup. 
That is, GetFont() in InitConfig() call fails and both data->fixedfont 
and data->normalfont are NULL (I dont have fonts configured).

data->font is corrected in MUIM_Show:

  DoSuperMethodA(cl, obj, msg);

    data->font      = ad->mad_Font;

but it is very well possible it

> > 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.
> No. If I am correct then the initialization done in MUIM_Setup should
> already setup the temporary rastport right before a Window_Open call and
> make it valid right on creation time of the TextEditor object.

I'll try to build test cases to see if there are problems. "Dont fix it if 
it aint broken" ... :)


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: