Forum

Results 1 to 4 of 4
  1. #1
    Join Date
    October 2015
    Location
    Germany, Bavaria
    Posts
    142

    My plugin causes weird crashes I can't explain myself

    Some information first:
    • I am using C++/CLI (C++ on windows with .NET bindings)
    • I am using the newest version of the TS3 Client


    So my issue lies in the following code:
    PHP Code:
    1  |void rebuildChannelList(uint64 schid) {
    2  |    ts3.logMessage("Rebuilding channeltree..."LogLevel_DEBUG"wk"schid);
    3  |
    4  |    Lists::channels->Clear(); // Empty current lists
    5  |    Lists::errors->Clear();
    6  |
    7  |    uint64result;
    8  |    int success ts3.getChannelList(schid, &result);
    9  |
    10 |    if (success) {
    11 |        ts3.logMessage("Successfully got the channel list"LogLevel_DEBUG"wk"schid);
    12 |        int i 0;
    13 |        while (result[i] != NULL) {
    14 |            Lists::channels->Add(result[i++]);
    15 |        }
    16 |        ts3.logMessage("Successfully built channel list"LogLevel_DEBUG"wk"schid);
    17 |    }
    18 |
    19 |    ts3.freeMemory(result);
    20 |    ts3.logMessage("Successfully freed channel tree memory"LogLevel_DEBUG"wk"schid);
    21 |} 
    Explaination:
    • The Lists::channels list has a type of uint64
    • In this state, it logs the lines 2 and 11
    • Without the while loop in line 13-15, the plugin crashes, but still logs line 16.
    • With the while loop, but without the freeMemory in line 19, the client still crashes and does not log line 16.
    • ONLY and ONLY when removing the loop and the freeMemory statement in line 19, the client starts.


    So seemingly the error is in both right?
    But I cant seem to find where it is, and it is mandatory that the IDs are used in a List<uint64>^ CLI structure.

    Does anyone know a reason why this is happening? I have no idea anymore...

  2. #2
    Join Date
    October 2015
    Location
    Germany, Bavaria
    Posts
    142
    Alright, appearently the issue happened because the client was not fully connected.
    So adding a line that checks if the client is fully connected fixed it.

  3. #3
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,376
    The direct cause might be, that you let the client free an initialized pointer (result) if getChannelList was not successful.

    You should move your call to freeMemory in your condition block.

    Apart from that you should consider comparing the error code returned by api calls with the constants in public_errors.h.

    If getChannelList is successful, it will return ERROR_ok (=0), so 0 will evaluate to false in this context.

    Code:
    if (0) {
      printf("0 is true\n");
    }
    if (1) {
      printf("!=0 is true\n");
    }

  4. #4
    Join Date
    October 2015
    Location
    Germany, Bavaria
    Posts
    142
    Yea I noticed that mistake later aswell. I am not used to using wannabe-bools that way.

    But thanks, now I know!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can somebody explain this?
    By Hot Carl in forum Windows
    Replies: 2
    Last Post: June 25th, 2012, 01:55 PM
  2. TS3 crashes (Volume plugin)
    By Grimmy in forum Bug Reports [EN/DE]
    Replies: 7
    Last Post: May 21st, 2012, 10:46 AM
  3. licesekey.dat (please explain)
    By Ar2rJke in forum Linux / FreeBSD
    Replies: 1
    Last Post: March 1st, 2012, 11:04 AM
  4. Plugin [minGW32] crashes on message in Channel Chat
    By TSPlugin in forum Client Plugins / Lua Scripts
    Replies: 1
    Last Post: April 3rd, 2010, 08:19 AM
  5. QApplication & QWidget in the Plugin crashes
    By Honc__ in forum Client Plugins / Lua Scripts
    Replies: 9
    Last Post: February 10th, 2010, 04:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •