mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-07 07:56:14 +00:00
Don't let Java choose when cleaning SmsBuffer, do it ourself
This commit is contained in:
parent
5e6a1fc28e
commit
11bbed02b8
@ -20,8 +20,8 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "fr.unix_experience.owncloud_sms"
|
||||
versionCode 51
|
||||
versionName "1.1.1"
|
||||
versionCode 54
|
||||
versionName "1.2.0"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
maxSdkVersion 26
|
||||
@ -29,7 +29,7 @@ android {
|
||||
// Specifies the ABI configurations of your native
|
||||
// libraries Gradle should build and package with your APK.
|
||||
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a',
|
||||
'arm64-v8a'
|
||||
'arm64-v8a', 'mips', 'mips64'
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
@ -51,7 +51,7 @@ jlong SmsBuffer::createNativeObject(JNIEnv *env, jobject self)
|
||||
|
||||
void SmsBuffer::deleteNativeObject(JNIEnv *env, jobject self, jlong ptr)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "deleteSmsBuffer");
|
||||
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "deleteNativeObject 0x%li", ptr);
|
||||
delete reinterpret_cast<SmsBuffer *>(ptr);
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,7 @@ public interface ASyncSMSSync {
|
||||
}
|
||||
}
|
||||
OCSMSNotificationUI.cancel(_context);
|
||||
_smsBuffer.clear();
|
||||
Log.i(ASyncSMSSync.TAG, "Stopping background sync");
|
||||
return null;
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ public class OCSMSOwnCloudClient {
|
||||
}
|
||||
|
||||
doHttpRequest(post);
|
||||
|
||||
if (_jsonQueryBuffer == null) {
|
||||
Log.e(OCSMSOwnCloudClient.TAG,"Request failed. It doesn't return a valid JSON Object");
|
||||
throw new OCSyncException(R.string.err_sync_push_request, OCSyncErrorType.IO);
|
||||
|
@ -24,13 +24,14 @@ public class SmsBuffer {
|
||||
|
||||
private long mHandle;
|
||||
|
||||
String TAG = SmsBuffer.class.getSimpleName();
|
||||
|
||||
public SmsBuffer() {
|
||||
mHandle = SmsBuffer.createNativeObject();
|
||||
}
|
||||
|
||||
protected void finalize() throws Throwable {
|
||||
SmsBuffer.deleteNativeObject(mHandle);
|
||||
mHandle = 0;
|
||||
clear();
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
@ -45,9 +46,21 @@ public class SmsBuffer {
|
||||
|
||||
public void push(int id, int mbid, int type, long date, String address, String body,
|
||||
String read, String seen) {
|
||||
if (mHandle == 0) {
|
||||
throw new IllegalAccessError("Pushing data to empty native handler, aborting");
|
||||
}
|
||||
SmsBuffer.push(mHandle, id, mbid, type, date, address, body, read, seen);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
if (mHandle == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
SmsBuffer.deleteNativeObject(mHandle);
|
||||
mHandle = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
JNI: Eepty method
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user