[TextEditor_mcc] Re: Editor test program crashes in MorphOS

  • From: Jens Langner <Jens.Langner@xxxxxxxxxxxxxx>
  • To: texteditor_mcc@xxxxxxxxxxxxx
  • Date: Tue, 16 Aug 2005 17:02:50 +0200

Ilkka Lehtoranta schrieb:

>>>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.

Ok great. I was really in fear stefan might have changed such a
fundamental thing. But now that you checked it I am calm again ;)

>>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?

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.

So please investigate again a bit further and try to see if
data->tmprp.Font is also NULL right after the SetFont() call above and
then try to track down where exactly it might get blanked out as this
might be another problem hided in some other component of TextEditor.

> 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.

cheers,
jens
-- 
Jens Langner                                         Ph: +49-351-4716545
Lannerstrasse 1
01219 Dresden                                Jens.Langner@xxxxxxxxxxxxxx
Germany                                      http://www.jens-langner.de/
_____________________________________________________________________________
TextEditor ML   - //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: