Quote:
Originally Posted by alkis
if, temporarily, you remove all code from your hook (i.e. your hook is empty) does it still crash?
|
The hook function itself (
highlightBlock()
) returns a ULONG, so it cannot be empty. I have tried just having it return 1L, but the system still freezes when I do that.
I have also tried leaving that function definition as it is, but not assigning it to the
Hook
in the
init()
function (which is probably what you meant). Here is that
init()
function:
Code:
static void init(APTR userData)
{
//__asm("\ttrap\t#0");
struct Filetype *fType = (struct Filetype *)userData;
if(!openLibs())
{
terminate(fType);
return;
}
//struct Hook *hook = (struct Hook *)AllocVec(sizeof(struct Hook), MEMF_CLEAR);
fType->pluginData = (ULONG)1234567; // any number or pointer of our choosing
fType->highlighterHook = NULL;
fType->typeName = "example";
fType->autoFileTypes = "example";
fType->terminate = terminate;
fType->settingsTitle = settingsTitle;
fType->settingsGadget = settingsGadget;
fType->processGadgetUp = processGadgetUp;
fType->setSettingsFromGUI = setSettingsFromGUI;
fType->setGUIFromSettings = setGUIFromSettings;
fType->applySettings = applySettings;
fType->saveSettings = saveHighlightSettings;
fType->loadSettings = loadHighlightSettings;
fType->disposeGadgets = disposeGadgets;
fType->name = "Example";
//hook->h_Entry = (ULONG (*)()) highlightBlock;
//hook->h_SubEntry = NULL;
//hook->h_Data = 1234567;
}
The first thing I tried was commenting out those last 3 lines. Then I also commented out the allocation of the hook (the
AllocVec()
line) and set
fType->highlighterHook = NULL
, and finally I also commented out the
highlightBlock()
definition completely. All 3 of those scenarios also resulted in a frozen system.
I then reverted back to the complete, uncommented
init()
function and tried putting the trap lower. If I put it after the
AllocVec()
line, I got
Software Failure #80000020
, which implies the allocation works.
Last thing I tried was putting the trap at the very bottom of the
init()
function. That gave a somewhat strange result: the dialog of the
Software Failure #80000020
started to appear, but the system froze before it could be rendered completely. So I ended up with frozen system showing a gray rectangle (without any text or other content) where the trap error would normally appear. This suggests to me that the end of the
init()
function was reached, but the system froze before it could finish rendering the
Software Failure #80000020
. I think I'm gonna have to sleep on that one..