-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Prevent NullPointerException by not setting the static instance #2061
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Completed the license agreement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
The same bug is in the 4.0 branch as well as I see two, btw |
Nice catch, thanks! We'll either have to change the interface in Glide v4 or do something more complicated since the Glide object isn't passed in to the Module in v4. |
Also license agreement still seems to be pending. |
… registration is complete
@sjudd same fix would work, all we need is |
I changed commit to include email as per the requirements of the CLA. Waiting for pending license agreement. Thx |
@Codeintheory can you double check the cla? Not sure what's up with the bot, but when I look for the email address in the commit or your username it doesn't find anything. Sorry for the inconvenience... |
I'd love to get this in, but still waiting on the cla, @Codeintheory is there some other email address that I should check? |
@sjudd I've updated my google CLA to match the email with github account. Please check again for [email protected]. Thx |
CLAs look good, thanks! |
until registration is complete
Description
The Glide instance is not completely thread safe as another thread may get an instance which have not had the components registered
Motivation and Context
With the current code, Thread 2 may get a glide instance because this.glide != null, but registration in Thread 1 has not completed yet
Thread 1- (Does initialization)
GlideApp.with(context).load().into(imageView);
Thread 2-
Loader loader = Glide.get(context).getLoaderFactory().buildModelLoader(modelClass, resourceClass);
Glide.with(mAppContext)
.using(modelLoader, OrbResource.class)
.from(OrbModel.class)
06-21 14:54:44.301: E/AndroidRuntime(29121): java.lang.NullPointerException: ModelLoader must not be null
06-21 14:54:44.301: E/AndroidRuntime(29121): at com.bumptech.glide.provider.FixedLoadProvider.(FixedLoadProvider.java:28)
06-21 14:54:44.301: E/AndroidRuntime(29121): at com.bumptech.glide.GenericTranscodeRequest.build(GenericTranscodeRequest.java:42)
06-21 14:54:44.301: E/AndroidRuntime(29121): at com.bumptech.glide.GenericTranscodeRequest.(GenericTranscodeRequest.java:60)
06-21 14:54:44.301: E/AndroidRuntime(29121): at com.bumptech.glide.RequestManager$GenericModelRequest$GenericTypeRequest.as(RequestManager.java:768)
etc...