new ZipFile returns null

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • new ZipFile returns null

      Hey there!

      Good news, my work for the last while shall hopefully soon be hitting the stage where i reveal the game and start showing updates publicly.

      Not so good news, as this is my first C++ project (that wasn't just my own little test), I'm quite new to the details of the whole debug/release differences.

      In fact, it wasn't until a few days ago that i tried to compile into a release mode.

      I've removed all bugs (fixed up the required .lib files, etc.), but now am coming across a really weird issue.

      When a new ZipFile is created (sorry, at a different computer, but the line is something like "m_pZipFile = new ZipFile" (in the existing GameCode4 source)) in debug mode, there are no issues. However in the release mode, the next line ("if (!m_pZipFile)") return true, in other words, the ZipFile instance isn't being created. Creating a breakpoint and putting my mouse over the variable (in VS2012) shows that the fields within the ZipFile class are all "???".

      Could anyone work out why this could be?

      I feel it is important to note the following:
      - I have not changed the ZipFile class, nor anything it uses.
      - The ResourceCache, ZipFile, etc. classes have all been moved to this project, it isn't using the non-resource related code
      - Stepping in to the line of new ZipFile first brings me to a memory allocation function, and then to a function in the xtree class (pretty sure that's what it's called), but not to the constructor. In debug mode, it goes first to memory allocation and then to the constructor, not to the xtree class.
      - No errors appear, the variable just can't be used as it is equal to NULL (0)

      Once again, thanks for any help. If you need more information I will provide it.

      The post was edited 1 time, last by Randomman159 ().

    • Are you sure it is returning NULL? When in release mode you can't rely on the watch window as many of the symbols will either be unavailable or be incorrect.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • The working directory is likely incorrect. You have to specify it for both Debug and Release, so you probably have it set up only in the debug build.

      -Rez
    • I have a question about that Rez, it seems as though anything under the 'Debugging' tab is stored in user specific options, however I have been told not to add user option files to source control. I specify both my working directory and path variable (I keep dll's separate until I package everything up) as relative paths.

      Is it actually stored in these user option files, they are the only ones I do not add, yet whenever the project is cloned somewhere, I need to re-add these settings. Is there a workaround to this?
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Yeah, you don't want to add user-options to source control. It has a lot of stuff you generally don't want to be shared across the project. Resetting your working directory is a pain but I haven't found any reasonable way around it. I only have two computers that I develop from so I haven't found it to be a huge hindrance. It's part of the one-time setup whenever setting up a new dev environment.

      -Rez
    • ok... my least favorite type of bug.
      The one that fixes itself overnight. Now i guess i won't know the fix.

      In regards to the release mode having an unreliable watch window, the code "if (m_pZipFile)" is reliable, which is where i based the statement of it being null from.

      After that seemed to all clear up (still wish i knew why), i then had the issue of the working directory being incorrect, so although you didn't solve the first issue, you solved the second one before it even popped up, so thanks :)

      If the first issues pops up again and i find the solution i'll put it here.
    • Sorry, I was reading it late at night, I don't know why I thought you said the watch window.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz