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

Make QSResourceManager thread safe #1871

Merged
merged 3 commits into from Jun 11, 2014
Merged

Make QSResourceManager thread safe #1871

merged 3 commits into from Jun 11, 2014

Conversation

pjrobertson
Copy link
Member

Fixes #1861

See #1861 for most of the discussion. This pull request won't necessarily 'fix all out problems', since there are probably still plugins that call [NSImage imageNamed:], whereas they should call [QSResourceManager imageNamed:]

@skurfer
Copy link
Member

skurfer commented Jun 8, 2014

Testing this out now.

@pjrobertson
Copy link
Member Author

I've generally found it pretty hard to reproduce the crashes, but I got them quite a bit whilst running QS from within Xcode (I guess it runs slower, so multi-threading issues are maybe more likely...?)
Also, rapidly opening QS after launch and opening the triggers prefs, then dancing between the triggers, plugins and catalog prefs quickly would give me the crash now and again :P

@pjrobertson
Copy link
Member Author

...actually I take that back. On master, I can reproduce a crash pretty reliable by:

  • Launch QS from Xcode (probably you can still get the crash if you run QS normally, I've only tested from Xcode)
  • Opening the QS interface straight after the splash screen's appeared (the quicker the better)
  • Opening the prefs with ⌘,
  • clicking the Catalog, Plugins, Triggers, Preferences icons/tabs at the top randomly and in quick succession

With this branch, I can't get QS to crash :'(

@skurfer
Copy link
Member

skurfer commented Jun 9, 2014

Continuing the discussion from #1868, since it probably belongs here:

I looked at my Console more closely and see that I have 3 other errors that are almost the same, but they all originated in -[QSObjectCell drawObjectImage:inRect:cellFrame:controlView:flipped:opacity:], so I don’t think it has anything to do with Trigger prefs. In that case, the method is calling name on a string, instead of setFlipped:, but same result.

The trigger that was missing its info was for “Mid Volume (40%)” from Extra Scripts, but like I said, it’s been fine ever since. (And I suppose I don’t know that the missing info is related to the Console messages, but I strongly suspect.)

@pjrobertson
Copy link
Member Author

Since it seems you're about (or just were)...

I've looked into this more closely and really can't figure out what the issue might have been. From what I can tell, the issue may well have been with getting the icon for a QSCommand, which just gets its icon from the icon from the dObject.

Shall we merge and get another pre-release out then monitor the crash logs/new issues? Even if it is related, we're hopefully stopping 60% of all crashes with this pull.

@skurfer
Copy link
Member

skurfer commented Jun 11, 2014

Sounds reasonable. I haven’t seen any more issues.

@skurfer
Copy link
Member

skurfer commented Jun 11, 2014

FYI, I don’t necessarily agree with not using QSRez. I’ve been going the other direction recently, using short names for the shared instance when available (i.e. QSLib). But I’m not going to hold this back over style. 😃

skurfer added a commit that referenced this pull request Jun 11, 2014
@skurfer skurfer merged commit bf0d645 into master Jun 11, 2014
@skurfer skurfer deleted the qsresourcemanager branch June 11, 2014 12:46
@pjrobertson
Copy link
Member Author

Yay!

So the reason I was against using QSRez is because the singleton format that I’ve seen most often has the static defined inside the sharedInstance method. I think the reason to avoid doing what you’re doing is that it could be possible in some cases to reference QSRez when it’s garbage (not been allocated yet)

calling -[QSResourceManager sharedInstance] of course ensures the singleton has been alloc inited.

On 11 Meh 2014, at 19:46, Rob McBroom notifications@github.com wrote:

Merged #1871.


Reply to this email directly or view it on GitHub.

@skurfer
Copy link
Member

skurfer commented Jun 11, 2014

I think the reason to avoid doing what you’re doing is that it could be possible in some cases to reference QSRez when it’s garbage (not been allocated yet)

OK. My only defense is that it was easier and looks nicer. You clearly have a stronger argument. 😃

@pjrobertson
Copy link
Member Author

OK. My only defense is that it was easier and looks nicer. You clearly have a stronger argument.

If looks weren’t important, then the world wouldn’t be the way it is. Now what do we do?! ;-)

On 11 Meh 2014, at 22:00, Rob McBroom notifications@github.com wrote:

OK. My only defense is that it was easier and looks nicer. You clearly have a stronger argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We shouldn't be using NSBundle as much as we are (not thread safe)
2 participants