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

QListView:items_ can crash sclang #835

Closed
jamshark70 opened this issue Apr 29, 2013 · 9 comments
Closed

QListView:items_ can crash sclang #835

jamshark70 opened this issue Apr 29, 2013 · 9 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead crash things which cause a crash in the interpreter, servers, or IDE. do not use for PRs
Milestone

Comments

@jamshark70
Copy link
Contributor

While researching a strange crash in the class browser, I found that the crash can be reproduced without using the class browser at all.

This ECM mimics what happens when a method search for "depend" is executed in the class browser. At first, the methodView is populated with a list of Object's methods. The method search replaces those items with the search result (quoted as a compile string).

x = Object.methods.collect { |m| m.name };

y = ListView(nil, Rect(800, 100, 240, 260)); y.front;
y.items = x;

// crash here
y.items = [ "addAsDependantOf (MixerChannel)", "addDependant (Nil)", "addDependant (Object)", "addDependantMC (MixerChannel)", "dependants (Nil)", "dependants (Object)", "dependantsDictionary (Meta_Object)", "dependencies (Quark)", "getDependencies (Quark)", "independent (Penvir)", "independent_ (Penvir)", "releaseDependants (Object)", "releaseFromDependencies (Object)", "removeAsDependantOf (MixerChannel)", "removeDependant (Nil)", "removeDependant (Object)", "removeDependantMC (MixerChannel)" ];
@jleben
Copy link
Member

jleben commented Apr 29, 2013

Strangely, I can't reproduce the issue.

@jamshark70
Copy link
Contributor Author

Did you run all the statements as one block?

Run the last statement separately from the others.

@jleben
Copy link
Member

jleben commented Apr 29, 2013

Yes, I tried various sequences of evaluation, including your suggested one, still nothing...

Wait, perhaps this only affects the master branch...

@jleben
Copy link
Member

jleben commented Apr 29, 2013

Hmm, nope, master is also OK here.

What's your system, Qt version?

@jamshark70
Copy link
Contributor Author

Ubuntu 12.04, Gnome Classic desktop. Synaptic tells me I've got Qt 4.8.1.

I experimented with the contents of the new items array and found that it crashes on "removeAsDependantOf (MixerChannel)" -- if I replace that string with something else, even a non-alphabetic string of the same size, no crash. For some super-bizarro reason, it seems to depend on the capital letters, but not on the order of the letters.

(
x = Object.methods.collect { |m| m.name };
y = ListView(nil, Rect(800, 100, 240, 260)); y.front;

f = { |newItems|
    {
        0.5.wait;
        y.items = x;
        0.5.wait;
        y.items = newItems;
    }.fork(AppClock);
};

a = [ "addAsDependantOf (MixerChannel)", "addDependant (Nil)", "addDependant (Object)", "addDependantMC (MixerChannel)", "dependants (Nil)", "dependants (Object)", "dependantsDictionary (Meta_Object)", "dependencies (Quark)", "getDependencies (Quark)", "independent (Penvir)", "independent_ (Penvir)", "releaseDependants (Object)", "releaseFromDependencies (Object)", "removeAsDependantOf (MixerChannel)", "removeDependant (Nil)", "removeDependant (Object)", "removeDependantMC (MixerChannel)" ];
)

// All of these are okay
f.(a.copy.put(13, "replaced"));
f.(a.copy.put(13, String.fill(34, $.)));
f.(a.copy.put(13, "replacedreplacedreplacedreplacedreplacedreplaced".keep(34)));

(
c = "replacedreplacedreplacedreplacedreplacedreplaced".keep(34);
(0..33).scramble.keep(5).do { |i| c[i] = c[i].toUpper };
f.(a.copy.put(13, c.debug));
)

f.(a.copy.put(13, "removeAsDependantOfXZAbcdeFghijklZ".scramble.toLower));

// This one crashes (only by reintroducing the capital letters)
f.(a.copy.put(13, "removeAsDependantOfXZAbcdeFghijklZ".scramble));

The crashes are consistent -- I can see no sensible pattern, but it does seem to be deterministic.

I have some local-only commits at the top of my private branch, so my next test will be to roll back to the pure master branch and try again (building now). But my local commits should have nothing to do with QListView.

@jamshark70
Copy link
Contributor Author

No difference with master-as-master.

@jleben
Copy link
Member

jleben commented Jun 21, 2013

Sorry, I still can't reproduce here.

@telephon
Copy link
Member

I can reproduce it here with the following, if you set n = 23, then it crashes the interpreter. This doesn't happen with other arrays of strings, so it may be specific characters in the method names.

(
n = 15;
x = Object.methods.collect { |m| m.name.asString }.keep(n);
y = ListView(nil, Rect(800, 100, 240, 260)); y.front;

f = { |newItems|
    {
        0.5.wait;
        y.items = x;
        0.5.wait;
        y.items = newItems;
    }.fork(AppClock);
};

a = [ "addAsDependantOf (MixerChannel)", "addDependant (Nil)", "addDependant (Object)", "addDependantMC (MixerChannel)", "dependants (Nil)", "dependants (Object)", "dependantsDictionary (Meta_Object)", "dependencies (Quark)", "getDependencies (Quark)", "independent (Penvir)", "independent_ (Penvir)", "releaseDependants (Object)", "releaseFromDependencies (Object)", "removeAsDependantOf (MixerChannel)", "removeDependant (Nil)", "removeDependant (Object)", "removeDependantMC (MixerChannel)" ];
)

f.(a.copy.put(13, "replacedreplacedreplacedreplacedreplacedreplaced".keep(34)));

@scztt scztt modified the milestone: 3.7 Apr 18, 2015
@scztt scztt added the crash things which cause a crash in the interpreter, servers, or IDE. do not use for PRs label Apr 19, 2015
@telephon
Copy link
Member

Works fine now.
@jamshark70 can you still reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead crash things which cause a crash in the interpreter, servers, or IDE. do not use for PRs
Projects
None yet
Development

No branches or pull requests

4 participants