Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when loading texture groups #2039

Closed
ldicker83 opened this issue Feb 17, 2018 · 5 comments
Closed

Crash when loading texture groups #2039

ldicker83 opened this issue Feb 17, 2018 · 5 comments
Assignees
Labels
Prio:1 Highest priority: Crash or crippling bugs, features that enable new ways of working Type:Bug Errors and problems
Milestone

Comments

@ldicker83
Copy link

ldicker83 commented Feb 17, 2018

fctf4-crash.txt
fctf4-crash.log
fctf4-crash.zip

System Information

TB v2.0.0-final on Windows 10

Expected Behavior

Was adding texture collections to the map. After hitting the add button TB crashes.

In the case of a crash, please upload the generated stack trace, log file, and map file along with this report.

Thank you very much!

@kduske kduske added this to the TrenchBroom 2.0.1 milestone Feb 17, 2018
@kduske kduske added Platform:Windows Prio:1 Highest priority: Crash or crippling bugs, features that enable new ways of working Type:Bug Errors and problems and removed Groomed labels Feb 17, 2018
@kduske
Copy link
Collaborator

kduske commented Feb 21, 2018

Which texture collection were you trying to add? Can you reproduce the problem?

@ldicker83
Copy link
Author

It's actually any of the collections and I realized after the fact that it happens after loading another map.

Steps are basically, load a map. Add texture collections.

Load another map. Add a collection and it immediately crashes. I haven't had the time to look into it yet myself (I have a forked version of TB I'm using for a project of mine) otherwise I'd have submitted a patch/pull request.

@kduske
Copy link
Collaborator

kduske commented Feb 22, 2018

No, I still cannot reproduce this. Sorry. I created a new map, added two texture collections, and saved it. Then I created another new map, added other texture collections, and saved that too. Then I restarted the editor, loaded the first map, added a texture collection. Then, without saving, I opened the second map, and added a texture collection. No crash. Do you have any other hints?

@kduske kduske self-assigned this Feb 22, 2018
@ldicker83
Copy link
Author

It could be that it's because I'm loading maps that were originally built in Qoole many years ago?

It's barfing in this function (file DirectoryTextureCollectionEditor.cpp, line 192):

        void DirectoryTextureCollectionEditor::updateListBox(wxListBox* box, const IO::Path::List& paths) {
            wxArrayString values;
            values.reserve(paths.size());
            
            for (const IO::Path& path : paths)
                values.push_back(path.asString()); // breaks here
            
            box->Set(values);
        }

I've been running this in the debugger and it's an access violation of sorts. Interestingly enough values can't be read by the debugger (values Error reading register value.) when in release builds so probably something to do with the optimizer.

As a side note, I'm seeing this only happening in release builds. When I build in Debug mode, the problem disappears. Makes me wonder if this is a side effect of the optimizer?

@kduske
Copy link
Collaborator

kduske commented Feb 23, 2018

Alright, found the problem: DirectoryTextureCollectionEditor did not have a destructor, thus it never called unbindObservers. But when you load a new map on windows, the texture collection UI is destroyed and created anew because it might choose a different UI depending on which game you are editing.

But then, the old observer was still called and executed on the now deleted texture collection editor, leading to the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio:1 Highest priority: Crash or crippling bugs, features that enable new ways of working Type:Bug Errors and problems
Projects
None yet
Development

No branches or pull requests

2 participants