Archicad C++ API
About Archicad add-on development using the C++ API.

`DisposableObject` in C++ API prior to Archicad 25?

Bitwreckage
Booster

Hi,

 

In fixing a crash issue involving our implementation of a `DG::Palette` I found this post in a forum thread: How-to-make-a-Palette-dialog-by-C-Class , which helped me solve my issue... except, building for Archicad 24 and below fails.


It turns out that the header file `Support/Modules/GSRoot/DisposableObject.hpp` does not exist in the Archicad dev kit prior to version 25.

 

I downloaded the development kits for versions 25, 24 and 23 to see if there might be mention of how one is supposed to implement this Palette dialog in versions before 25. However, I found that the documentation in both version 24 and 23 mentions both `DisposableObject` and `DisposeHandler` in e.g. the description of `APIPaletteControlCallBackProc`.

Is the documentation for these old versions ahead of time, or are files missing from the SDK in these older versions?

And last but not least: Can we somehow get our code to compile (and work) the way it is now, or do I have to do a version split so that we do it the way we used to do for versions <25 and the "fixed way" on versions 25+?

 

-- 

 

Kind regards

 

Steffen Skov

dRofus

 

6 REPLIES 6

Hi Steffen,

 

There are other similar ways to make a DG::Palette without the DisposableObject class. I never used the DisposableObject class and from giving a quick look at the example I'm not yet convinced about any major benefits from it.

If I remember correctly, I started with the "DG_Test/OwnerDrawnListBoxPalette" example to get started with Palettes. This is already available in AC24 and I got it to work across several API/AC versions.


Hope that helps,
Bernd

Bitwreckage
Booster

Thank you, Bernd!

 

This helped me on my way. I have now tested with both Archicad 22 and 27, and it seems to work wonderfully! Fingers crossed that the success continues with 28.

 

-- 

 

Kind regards

 

Steffen Skov
dRofus

 

A little update on the issue here.

 

I had to "unaccept" the accepted solution, as it turned out that avoiding the `DisposableObject` approach crashed in Archicad 28.

 

In our code base, not utilizing `DisposableObject` worked for Archicad versions up to and including 27, but with 28 it does not work without it.

My solution has been to define conditional compilation so that when we build for pre-28 versions we exclude the `DisposableObject` parts, and include them when building for version 28.

 

-- 

 

Kind regards

 

Steffen Skov
dRofus

 

Hi Steffen,


I haven't run into this issue yet for AC28. Do you have any insights why the crash is happening without DisposableObject? So us other developers can prepare as well 🙂

 

Best,
Bernd

Hi Bernd,

 

I realize that I in fact did not specify the steps to make it crash.

Just creating and displaying the panels work nicely with or without the use of `DisposableObject`, but when we close the panels it crashes in AC28 if we do not utilize the `DisposableObject` class.

As for the "why?", I am clueless I must admit. If I remember correctly the call stack was deep into Archicad territory, so not much info to gather.

 

-- 

 

Kind regards

 

Steffen Skov

dRofus

 

Thanks Steffen for the clarification! 🙂
My first thought is, that it might be related to the new memory allocators in AC28.
I'll play around more when I have time to see if I can trigger a crash in my Add-Ons as well.

Best,
Bernd

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!