blaidddwr / socref

Socrates' Reference
Other
1 stars 1 forks source link

Add C++/Qt Language Widgets #7

Open blaidddwr opened 8 months ago

blaidddwr commented 8 months ago

Add the C++ and C++/Qt language widgets. This is a sub task for the larger issue #2. This builds on top of the previous sub task of completing the model and blocks for the core application and respective languages.

This will build of GUI of the application to be able to see all the coding done for the model and manually test anything required.

The unit tests from the previous model sub task were left incomplete due to needing manual running of the application to figure out how to code the automatic tests. Completion of the unit tests will be done in this sub task, along with making a GUI interface for running all unit tests.

blaidddwr commented 7 months ago

Discovered a very strange bug when attempting to add new blocks to the root block in a project widget. This action would sometimes, and only for certain projects, cause a segmentation fault in the application. When debugging it with a full stack trace, the entire stack was within Qt's internal code and does not touch this application's code.

My best guess to the cause of this bug is a behavior I noticed with the Qt tree view class; it does not like having an invalid(root) index and will forcefully update its current index at random times. My guess is when the index is updated, my update add actions is called, which deletes the previous add actions, but then somehow this is done in the middle of triggering one of those add actions when the current index is invalid.

Thanks to @stablizer's suggestion of adding a second add menu called "Add to Global" which is devoted to adding new blocks to the global, or root, block, I was able to circumvent this peculiar bug. Thankfully the "Add to Global" actions work every time in the projects where it never works with the old add menu. To prevent this bug form happening the old add menu is no longer allowed to add to the root block.

This issue was resolved in commit 1fe5afa4ca34e37b973f29c36a739bb66aaa7815.