After writing my last article and publishing the updates to the DGH IDE Notifier, I found a situation where one of the notifiers raised an access violation.
The notifier in question is the IOTAEditorNotifier
and the method ViewNotification
. I found that if I viewed the form design as text this method would be called with a NIL
View parameter. Not sure why the IDE does that but I’ve added a guard to cater for this as shown below:
Procedure TDINSourceEditorNotifier.ViewNotification(Const View: IOTAEditView; Operation: TOperation); ResourceString strViewActivate = '.ViewActivate = View: $%p, Operation: %s'; Const strINTAEditViewNotifier = 'INTAEditViewNotifier'; Begin DoNotification( Format( strViewActivate, [ Pointer(View), GetEnumName(TypeInfo(TOperation), Ord(Operation)) ] ) ); {$IFDEF DXE100} If Assigned(View) Then // New Guard Case Operation Of // Only create a notifier if one has not already been created! opInsert: If FEditViewNotifierIndex = -1 Then Begin FView := View; FEditViewNotifierIndex := View.AddNotifier(TDINEditViewNotifier.Create( strINTAEditViewNotifier, FileName, dinEditViewNotifier )); End; // opRemove Never gets called! opRemove: If FEditViewNotifierIndex > -1 Then Begin View.RemoveNotifier(FEditViewNotifierIndex); FEditViewNotifierIndex := -1; End; End; {$ENDIF DXE100} End;
regards
Dave.