C++ CHOP Crashing While Unloading DLL

Hello all,

I’m working on a C++ chop that controls the lighting of Corsair gaming keyboards. I’m new to C++ so this may be a basic issue.

I’m using the official iCue SDK provided on their site which provides a few header files containing the public interface for it’s DLL. My chop takes RGB data in and calls these functions to change the LED colors. This part seems to work fine- I can communicate with the device and change the LEDs.

The issue is when I try to destroy the CHOP instance in any way, (unloading the plugin, closing TD, ect) TD hangs and crashes. It seems like the destructor for the CHOP is not properly destroying something, but I’m not sure how to solve this.

I’m using the iCue SDK version 3.0.301 | 07/01/2019.

The project can be found here -
github.com/franklin113/iCue-Lighting-Chop

The header file CUESDK.h is where I think I’m missing something-
github.com/franklin113/iCue-Lig … e/CUESDK.h

Any help would be greatly appreciated!
Thanks,
Tim

You can attach the debugger to the TD process to see where the crash is happening. It’s possible it’s happening in your code or the SDK. Make sure you compiled your .dll as debug for this.

Thank you Malcom! I hadn’t used the VS debugger with TD yet.

It seems that DestroyCHOPInstance and ~CPlusPlusCHOPExample are being called properly and I was able to print to the console from within both functions.

After stepping past my print statement within the CPlusPlusCHOPExample destructor, TD hangs and I get no errors or feedback.

How do I get more details on what’s happening?

Thanks again,
Tim

Do you have any static objects or objects declared outside of the class that may be getting destructed?

Hmm… The header provided has some struct and enum declarations, but I’m fairly certain I’m creating my own instances of all of these within the CPlusPlusCHOPExample class. I put a break point inside my destructor and within the locals and autos list only TD related objects were there. Pretty sure everything goes out of scope after the execute function.

Still learning C++ so I may be overlooking something basic!

An example declaration from the sdk-

struct CorsairLedColor // contains information about led and its color. { CorsairLedId ledId; // identifier of LED to set. int r; // red brightness[0..255]. int g; // green brightness[0..255]. int b; // blue brightness[0..255]. };