On 25 Jul 2006, at 20:35, Phil M wrote:

I haven't had the time to work on my plugin until just a few minutes ago, but I think that I have isolated the crash... well at least I figured out what it is not.

Contrary to what I thought on Saturday morning, the plugin is not crashing when I try to create the object. Instead the crash occurs when I try to access *any* of the methods of the object. It is as if the object is Nil, but according to REALbasic the object is *not* Nil ("If (obj Is Nil) Then"). The really bizarre thing is that properties seem to work fine.

The only example that I have for classes is Thomas Tempelmann's Plugin Starter. In this he uses REALbasic to create the class structure and then uses a standard "C struct" to contain all of the data of the class. That is the model that I am following since it allows me to let REALbasic handle the object creation/destruction.

In every method he has the following call to an unknown (to me) method called "ClassData()" and uses a variable that I am not familiar with ("me"). Is this method and variable part of the REALbasic Plugin SDK? I cannot find any reference to them in the documentation. Here is an example of one of his methods using this call:

static void sampleBoolRefGetter (REALobject instance, RBboolPar *value)
// returns a boolean value via a BYREF parameter
{
        ClassData (sampleClass, instance, sampleClassData, me);
        *value = me->aBoolean;
}


My guess is ClassData is returning the wrong value. Is everything set up correct? instance is probably correct, but is sampleClass good, or sampleClassData?

Try something like:

if (!me) {
        REALMessageBox( "argh me=nil" );
}

Except you'll need a function which takes a char*, as REALMessageBox takes a REALstring.

Can you set breakpoints in your plugin? Or printf stuff to the console? You must be able to DebugStr stuff to the console... that's always on OSX.

Since this works perfectly for properties, I am really confused as to why any call to the class methods will crash.

In the crash log, the crash is because of:

-----------------------------------------------------------------
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0   <<00000000>>    0x00000000 0 + 0
1 rbframework.dylib 0x0028e390 RuntimeMenuItemClick + 868 2 rbframework.dylib 0x0027bc74 AppCarbonEventHandler (OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 316
-----------------------------------------------------------------

Which looks to be like I am trying to access a NULL pointer. Yes, I am calling my plugin test code from a MenuItem which is how the final app would be used as well.

In case you need my stats:
  - REALbasic 2006 r3 (release)
  - REALbasic Plugin SDK packaged with 2006 r3
  - CodeWarrior 9.2
  - OS X 10.4.7
- Compiling plugin as Carbon with links to "CarbonLib" and "MSL_C_Carbon.lib" - Compiling test app in REALbasic as Mach-O to enable full support for CrashLog

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>



--
http://elfdata.com/plugin/



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to