We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Crash in destructor of DG::Browser

andrewille
Participant

Hello,

I am experiencing random crashes in the destructor of my class, which extends the DG::Browser class. The weird thing is that I do not override the destructor. So I think this might be an issue of ArchiCAD 26.


Can somebody relate or has a solution for this? Thanks.

10 REPLIES 10
andrewille
Participant

Still occuring in AC27 5003 INT FULL. I uploaded the log files.

We really need this to be fixed @Viktor Kovacs @Akos Somorjai 

 

Akos Somorjai
Graphisoft
Graphisoft

Hi Andre,

 

Have you submitted this as a bug report? If so, could you please tell me the bug ID you received? This would give me more information.

 

Thanks, Akos

Hi @Akos Somorjai ,

here is the report ID: AC26-2024-06-27-12-29-23-7213

It is happening randomly on shutdown of ArchiCAD, in the destructor of DG::Browser. I reproduced it in AC26 right now because it happens more often so it was easier to trigger it.

Akos Somorjai
Graphisoft
Graphisoft

Hi Andre,

 

Thanks, that's very useful! I forwarded your request to a developer who knows more about this.

Hi Andre,

 

We haven't found the exact cause – yet. How are you destroying the DG::Browser instance?

 

Thanks, Akos

andrewille
Participant

Hi Akos,
here is a brief snippet of the hierarchy:

class LicenseManagerNew {
  static LicenseManagerNew *instance; // singleton class
  OAuthPalette loginPalette;
  ~LicenseManagerNew(); // destructor implemented, but does not explicitly destroy loginPalette
}

class OAuthPalette : DG::Palette {
  OAuthBrowser browser;
  // no destructor implemented
}

class OAuthBrowser : DG::Browser {
  // no destructor implemented
}

The crash happens only sometimes on shutdown on ArchiCAD. As you can see, LicenseManagerNew is a singleton class which gets destroyed automatically. The destructor of it does not explicitly destroy the other components I showed, but it happens implicitly on the end of the destructor (automatically). I have not implemented any other destructors, the exception is thrown internally in the DG::Browser's destructor. I haven't recognized any pattern how to trigger it exactly, but before exiting, the browser was used and a connection might still be open (if HTTP/2 if supported, at least).

 

Kind Regards

André

andrewille
Participant

@Akos Somorjai 

Any news on this? Have you sent them the stacktrace I uploaded?

Akos Somorjai
Graphisoft
Graphisoft

Hi André,

 

Just two "maybe" ideas so far:

- for some reason, the creation of the browser fails – do you receive any error?

- memory overwrite in BIMmTool -- have you run the add-on with any memory checks?

 

Best, Akos

Hi Akos,

the browser was created and worked fine. It's just its shutdown that causes issues. The access violation is triggered in the ArchiCAD code (as seen in the stacktrace). It tries reading a null pointer (as seen in the log). I don't think it would access any of the pointers managed by BIMmTool, would it?

To me this looks like some race condition. As I said, the destruction happens when the singleton class gets destroyed, which might happen very late. It might be so late that ArchiCAD has already freed some memory it needs for the destruction.

As a workaround, I will try to manually destroy the DG::Browser earlier now, i.e. when the project is closed. It is hard to tell whether this fixes it because it occurs so randomly. I will keep you updated.

 

Kind Regards

André

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!